-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple entry points #1119
Conversation
Umm doesn’t this break backwards-compatibility for anyone using Parcel programmatically (requiring Parcel and then manually instanciating Bundler)?? 🤔 |
Should be backward compatible. It will check if the input is a string rather than an array, and convert it for you. Lines 65 to 80 in 81aaf9b
|
Oh cool didn’t notice that 👍 |
@devongovett I would love to see this feature! Unfortunately, It looks like the Appveyor build is failing a Vue.js integration test:
I'm kind of a first-timer here, but is there anything I can do to help? |
@briandk: it seems unrelated to the PR, tracked by #1110 about it and it should be fixed by #1090. Feel free to check out our 👶 Good First Issue though, contributions are more than welcome :) |
For those who wish to try it #cuttingEdge: "scripts": {
"postinstall": "cd node_modules/parcel-bundler && npm i"
},
"devDependencies": {
"parcel-bundler": "github:parcel-bundler/parcel#multi-entry"
}
|
@devongovett support middleware as the following ❓
|
But now I have to access Could it be a little smarter to know that I want |
I don't find any mention of this (great) feature in the doc. If I don't, maybe adding a line or two in the api section will greatly help (I've searched among github issues before discovering the feature was already there). |
is there an issue it? |
@devongovett thank you for such an amazing bundler.
pls write it somewhere on your site. Because it is such a great future and I was amazed when I found it |
Second this.
|
waiting for use this feature 😂 |
when I bundle multiple entry points, I get my SCSS converted to CSS and bundled with bootstrap.css as expected and jquery.js/bootstrap.js/custom.js bundled on the first html file in alphabetical order, and the rest only HTML & JavaScript, it is not adding the fyi: each page (index.html, about.html, etc) links to index.js like so... and the contents of index.js are...
So to reiterate, the first entry point (in alphabetical order, in my case it chooses about.html) gets links to both the bundled css & javascript, but the rest of the pages only get a link to the bundled javascript. Here are the resulting about.html and index.html after having executed |
@elsheepo I have the same issue but in my case I could solve it writing |
I just added this to the docs. Would love to hear if anyone has a solution to the index.html no longer working with multiple entry points |
Looks like this is still an issue
|
Man, I had the same issue. I solved it doing this: instead of call index.js in each HTML file, I created a js for each html, and import index.js on each file. |
Doesn't multiple entrypoints require different respective exit points? I do not want all my entrypoints to yield one dist file. Sometimes I'm transpiling a module or library and then converting it to a string to be injected at runtime. This is currently something I'm unable to do for parcel. Perhaps with a custom prefix? But then I cannot ship this code if it's consumed as esm Alternatively, I use transpilation to pre-compile static versions of my page namespaced under a categorization folder and would like to run those in parallel. I can do this with rollup (awkwardly) but cannot do it in Parcel |
You can do it with targets. Each target can have a source field that defines its entry point, and a top level field for the output or a distDir within the target. https://parceljs.org/features/targets/#package.json%23targets.*.source |
Can you use glob patterns to handle a parallel series of sources with parallel targets (like statically generated variations of a website) |
Any resolution to this issue yet? there is solution discussed here. HOwever, seems it does not work. https://stackoverflow.com/questions/69029045/deploying-problem-with-multiple-html-files-parcel |
No fix - I ended up having to move to Vite just to get this feature unfortunately |
Vite is just roll-up with a bunch of defaults. I ended up going back to basics and doing everything in roll-up and gulp for more granular control. KISS Tired of wasting most of my time with build tooling instead of just building. |
Closes #189.
This PR adds support for multiple entry points to Parcel. It works by simply adding an additional fake node at the root of the bundle tree and attaching each entry asset to it as a child. If there is only one child, that child bundle is returned as it was before for convenience and to maintain backward compatibility.
Entry points can be passed to parcel as a list of files, or as a glob or list of globs. e.g.
parcel *.html
will run parcel over all HTML files in the current directory. Common dependencies between the entry points, such as a shared JS file, are deduped and produce a single output file that is linked to by both HTML entry points.