Skip to content

[Watch mode issue] Webpack watch not working with webpack-cli@4 #1923

@zatloeri

Description

@zatloeri

Describe the bug

When using watch mode as given in the following webpack.config.js:

module.exports = () => ({
    entry: path.resolve(__dirname, 'src/index.ts'),
    mode: NODE_ENV,
    watch: true,
    target: 'node',
...
// rest of config (uninportant I think)
...
}

with these dependencies for webpack:

    "webpack": "4.44.2",
    "webpack-cli": "4.0.0"

Webpack will not run with watch mode on.
But with the following deps it will run as expected:

    "webpack": "4.44.2",
    "webpack-cli": "3.3.12"

Also should mention that I am using:

yarn version - 1.22.4
node version - v14.13.0

What is the current behavior?

The compilation starts and finishes without any error, but it does not continue to watch for changes.
It acts as if watch is disabled.

To Reproduce

  1. Clone my example repo
  2. run yarn install
  3. run yarn test
    • Observer the problem
  4. run ./swapDeps.sh (or swap deps manually)
  5. run yarn test
    • Observe functioning watch mode

Alternatively just install the mentioned deps and try to run webpack in watch mode.
Then switch them for the working ones and run again.

Expected behavior

Webpack will run in watch mode consistently with webpack-cli@4.0.0 as
it works with webpack-cli@3.3.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions