Issues like #774 & #972 are fine as long as the new entry-point can have vendors & commons.js extracted the same as main.js.
Resolving this _requires exporting a different webpack config_, but the signature requires return config;, as return [config, otherEntryConfig]; fails.
If an array of configs were supported by default, having separate build targets (e.g. #1245) & entry-points could be possible.
@ericclemmons Yep. That should be possible.
But it might cause a duplication of modules in two bundles.
@arunoda That's correct and to be expected by multiple configs (potentially) referencing shared modules.
What next does today by remove duplicates between pages is smart, but isn't necessarily applicable to all scenarios (server, or providing <script> tags to 3rd parties).
My current project would greatly benefit from this. I am happy to contribute if given a direction.
Having multiple build targets manually by manipulating webpack is not something we want to expose to users. We do want to expose build targets however. This will be added in the near future.
This is a rather old issue, but since Next.js 5.0 we run webpack on both server and client code, solving most issues related to universal compilation.
Most helpful comment
@arunoda That's correct and to be expected by multiple configs (potentially) referencing shared modules.
What
nextdoes today by remove duplicates between pages is smart, but isn't necessarily applicable to all scenarios (server, or providing<script>tags to 3rd parties).