-
-
Notifications
You must be signed in to change notification settings - Fork 644
Description
Describe the bug
We're having issues updating to webpack 5 and webpack serve. Our project is divided into multiple webpack configurations. Say for example we have one configuration for a SPA /login/ , /portal/, our application for end users and /admin/ for our administrators. We do this, so that every SPA when hosted belongs into its own folder and we can easily make sure that critical code like in our /admin/ SPA is never served outside of intranet. Now to test locally, we use webpack-dev-server's multi project configuration. Every SPA is identifiable by an unique publicPath (e. g. /admin). This worked beautifully with webpack-dev-server, but with webpack 5 and webpack-cli this is no longer the case. We use multiple webpack configurations to test our
We used to use webpack-dev-server to start our development server directly, however as I understand that is no longer working with webpack 5.
What is the current behavior?
Webpack-cli outputs a an error message:
Error: Unique ports must be specified for each devServer option inyour webpack configuration. Alternatively, run only 1 devServer config using the--config-name flag to specify your desired config.
at Object.startDevServer [as default]
To Reproduce
Steps to reproduce the behavior:
https://github.com/webpack/webpack-cli/blob/master/test/serve/basic/multi-dev-server.config.js without the explicit ports does show my use case perfectly.
Expected behavior
If publicPaths for configurations are unique, webpack serve should be able to serve them from the same port.
Screenshots
Please paste the results of webpack-cli info here, and mention other relevant information
Additional context
Maybe this was first introduced with #1649 A possible solution might be to change
| export default function startDevServer(compiler, devServerArgs): object[] { |
publicPaths if ports are not unique.
Thanks a lot,
Christian