webpack/webpack-cli

ConcurrentCompilationError when specifying devServer.port in multiple configurations

alexdavid opened this issue · 2 comments

Bug report

When exporting multiple configurations, dev server seems to be aware that the ports must be different per config (it returns a helpful error if the ports are the same). However, if the ports are different it outputs the error:

[webpack-dev-middleware] ConcurrentCompilationError: You ran Webpack twice. Each instance only supports a single concurrent compilation at a time

and it seems to compile each configuration twice.

Actual Behavior

webpack serve returns a ConcurrentCompilationError, and outputs compilation information for each asset twice

Expected Behavior

webpack serve returns no error and outputs compilation for each asset once.

How Do We Reproduce?

Minimum reproducible repo here. Run yarn webpack serve and observe the error and that there are 4 compilation outputs instead of 2. Note that when removing the devServer from configuration it works as expected.

Please paste the results of npx webpack-cli info here, and mention other relevant information

  System:
    OS: Linux 6.1 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 53.11 GB / 62.70 GB
  Binaries:
    Node: 18.12.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
  Packages:
    webpack: ^5.75.0 => 5.75.0
    webpack-cli: ^5.0.1 => 5.0.1
    webpack-dev-server: ^4.11.1 => 4.11.1

outputs compilation information for each asset twice

#3604 (will be fixed soon)

webpack serve returns a ConcurrentCompilationError

#2408

Anyway you can ignore error mesage, because all works fine