Skip to content
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

Support array of webpack configs in next.config.js #1306

Closed
ericclemmons opened this issue Feb 27, 2017 · 4 comments
Closed

Support array of webpack configs in next.config.js #1306

ericclemmons opened this issue Feb 27, 2017 · 4 comments

Comments

@ericclemmons
Copy link

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 ericclemmons changed the title Support array of configs in next.config.js Support array of webpack configs in next.config.js Feb 27, 2017
@arunoda
Copy link
Contributor

arunoda commented Feb 27, 2017

@ericclemmons Yep. That should be possible.
But it might cause a duplication of modules in two bundles.

@ericclemmons
Copy link
Author

@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).

@dylanjt
Copy link

dylanjt commented Feb 26, 2018

My current project would greatly benefit from this. I am happy to contribute if given a direction.

@timneutkens
Copy link
Member

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.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants