webpack: webpack watch mode not working....

General Information: webpack version: 1.13.2 OS: Windows 10 Anniversary Update and webpack is running in Windows Subsystem for Linux(The new bash on Ubuntu)

I"m trying to run webpack in watch mode by using:

webpack --watch

and by also setting watch mode in config:

context: path.join(__dirname, '/src'),
devtool: debug ? 'inline-sourcemap' : null,
entry: './js-src/scripts.js',
watch: true,
module: {

All webpack does is run the transpiler and exit.
Example of output when running watch mode:

Hash: 045070ba2ed9ce40edf7
Version: webpack 1.13.2
Time: 2146ms
         Asset     Size  Chunks             Chunk Names
scripts.min.js  1.89 MB       0  [emitted]  main
    + 172 hidden modules

I’m not sure what i’m doing incorrect?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 17
  • Comments: 37 (7 by maintainers)

Most upvoted comments

Try this workaround:

Add this to your webpack configuration file:

    watchOptions: {
        poll: true
    },

For googlers, On wsl 2 you have to set poll, poll: 1000 worked for me.

I have similar problem on Linux Mint 18.2. After fix inotify issue works fun 😃

watchOptions: { poll: true }

Thank you. This solution works for me.

Nevermind… The problem was the ! in the directory name 😕

I am on webpack 3, and I have poll option enabled, still Webpack picks up first few writes and then doesn’t do that. I have tried saving the files via emacs and atom.

@mastercactapus I would be glad to help you (i’ve created chokidar). Are you able to set up a demo git repo that makes it easy to replicate the issue?

@lahdo Thank you so much. It works. Here is part of my Webpack setting.

module.exports = {
  watchOptions: {
    ignored: /node_modules/,
    poll: true
  }
};
  • “webpack”: “4.31.0”,
  • “webpack-cli”: “3.3.2”,
  • “webpack-dev-server”: “3.10.3”
  • WSL 2
  • Distributor ID: Ubuntu
  • Description: Ubuntu 18.04.5 LTS
  • Release: 18.04
  • Codename: bionic FYI webpack watch option https://webpack.js.org/configuration/watch/#watchoptionspoll However, but I still don’t understand that I don’t have to set this option when I use Windows. If someone can explain, I will appreciate it. Thanks.

I had this problem, just updated webpack-cli from 4.0.0 to 4.1.0 and it fixed it!

@zatloeri Please create reproducible test repo and open an issue in webpack-cli