Skip to content

Parcel Example#24

Merged
ericclemmons merged 3 commits intomasterfrom
24-parcel
Mar 10, 2019
Merged

Parcel Example#24
ericclemmons merged 3 commits intomasterfrom
24-parcel

Conversation

@ericclemmons
Copy link
Owner

This works pretty easily via this:

const Bundler = require("parcel-bundler");
const path = require("path");

const publicPath = path.resolve(__dirname, "../public");
const publicUrl = "./dist";

const bundler = new Bundler(path.resolve(publicPath, "index.html"), {
  outDir: path.resolve(publicPath, publicUrl),
  publicUrl
});

module.exports = bundler.middleware();

But I still want to enable index.*.js to support a package.json.

@ericclemmons
Copy link
Owner Author

@ericclemmons
Copy link
Owner Author

This is even better!

const Bundler = require("parcel-bundler");
const bundler = new Bundler("./src/index.html", { outDir: "./public" });

module.exports = bundler.middleware();

The trick here is to use ./src for the source, and write out to ./public.

(polydev could expose dist, but I think that's not specific enough, since other build tools could expose server-side files to dist)

@ericclemmons ericclemmons merged commit 346d66d into master Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant