Skip to content

Incorrect warning about watch command #3778

@MoritzLost

Description

@MoritzLost

Describe the bug

After updating to 5.1.0, I'm getting the following warning when I run npm run start:

[webpack-cli] No need to use the 'watch' command together with '{ watch: true | false }' or '--watch'/'--no-watch' configuration, it does not make sense.

However, this warning doesn't make sense – we're not using the watch command.

The start command runs this command: webpack --watch --config webpack.development.js

It only uses --watch, not watch, and our webpack config doesn't include a watch option. Switching --watch to watch makes the error go away.

What is the current behavior?

The warning above is displayed even when it shouldn't be, based on the command used.

To Reproduce

Not sure – running the command above results in this error. This warning didn't show up in 5.0.1 (same configuration and command), so it has to have been introduced in 5.0.2 or 5.1.0.

Expected behavior

The warning above should only be output if the watch command is actually used.

Additional context

npm webpack-cli info

  System:
    OS: macOS 13.3.1
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 128.16 MB / 16.00 GB
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn
    npm: 9.6.4 - ~/.nvm/versions/node/v18.15.0/bin/npm
  Browsers:
    Chrome: 113.0.5672.63
    Firefox: 112.0.2
    Firefox Developer Edition: 113.0
    Safari: 16.4
  Packages:
    babel-loader: ^9.1.2 => 9.1.2 
    clean-webpack-plugin: * => 4.0.0 
    compression-webpack-plugin: ^10.0.0 => 10.0.0 
    copy-webpack-plugin: ^11.0.0 => 11.0.0 
    css-loader: ^6.7.3 => 6.7.3 
    postcss-loader: ^7.3.0 => 7.3.0 
    sass-loader: ^13.2.2 => 13.2.2 
    webpack: ^5.82.0 => 5.82.0 
    webpack-cli: ^5.1.0 => 5.1.0 
    webpack-manifest-plugin: ^5.0.0 => 5.0.0 
    webpack-merge: ^5.8.0 => 5.8.0 
    webpack-remove-empty-scripts: ^1.0.3 => 1.0.3 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions