-
Notifications
You must be signed in to change notification settings - Fork 288
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
Supporting multiple entry points #113
Comments
Not sure I agree with this one (at least yet). If you want multiple entrypoints, wouldn't you invoke |
The benefit of permitting multiple entry points is you can get chunks that share code between them. So for example, it might be possible for acorn to be shared between Webpack and the asset reloader plugin for example (if they're the same version). This in turn reduces the build size and lazy load times. |
True but there's still the tradeoff in hitting disk in that case, as well as increasing complexity in the API. Open to thinking about this one, but probably not a priority. |
It turns out this is a prerequisite to the next.js integration due to the use of webpack internals effectively requiring a multiple entrypoints build. |
Since we're doing a major here I think this is a good opportunity to make output just a files map for ncc, as that will naturally support the multi-entry case a lot more nicely. Hoping to get a PR up for this soon. |
@guybedford @styfle, was this never re-implemented? I am guessing this could still be done programmatically, but an example of that would be nice. |
In our own build we build all of the various entry points separately.
It should be possible to have all the entry points be a single "build operation".
The thing about this is that it does involve an API change - no longer just returning
{ code, map }
but returning a{ code, map }
pair for each entry point built.We could possibly even just have the build output a single
files: { [name]: source }
object wherefiles[filename]
contains the entry points, and do this as a breaking API change.Alternatively the single-file v multiple entry point builds could be seen as separate APIs.
When done, the benefit of this would be that instead of duplicating code between the entry point builds, webpack can ensure they have code sharing between them.
This should reduce the self-hosting footprint size considerably too.
The text was updated successfully, but these errors were encountered: