`compiler.watchMode` should be `true` when running `webpack-dev-server`
See original GitHub issueBug report
What is the current behavior?
When using a plugin while running webpack-dev-server, compiler.watchMode is false, yet the watchRun and watchClose hooks are active.
If the current behavior is a bug, please provide the steps to reproduce.
- create a
WebpackPluginInstancethat gets passed aCompilerin itsWebpackPluginInstance#apply(compiler: Compiler)method. - run
webpack serve - the
compiler.watchModeisfalse, yet thewatchRunandwatchClosehooks are active.
What is the expected behavior?
- create a
WebpackPluginInstancethat gets passed aCompilerin itsWebpackPluginInstance#apply(compiler: Compiler)method. - run
webpack serve - the
compiler.watchModeshould betrue.
Other relevant information:
webpack version: 5.70
Node.js version: 16.13.0
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Watch and WatchOptions | webpack
Turn on watch mode. This means that after the initial build, webpack will continue to watch for changes in any of the resolved...
Read more >Detect `--watch` mode reliably · Issue #3460 - GitHub
Hi @sokra. I'm making https://github.com/s-panferov/awesome-typescript-loader and I need some way to detect if webpack is working in --watch ...
Read more >webpack --watch isn't compiling changed files - Stack Overflow
Watch mode is turned off by default so watch: true might work as well. Polling is the continuous checking of other programs or...
Read more >webpack-dev-server
The webpack-dev-server supports multiple modes to automatic refresh the page: ... webpack(config); var server = new webpackDevServer(compiler, { hot: true .
Read more >ts-loader - npm
Running. Use webpack like normal, including webpack --watch and webpack-dev-server , or through another build system using the Node.js API.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thank you so much, Alexander!! The
shutdownhook is indeed what I was looking for!How come it’s not documented anywhere I’ve looked? For instance, https://webpack.js.org/api/compiler-hooks/ makes no mention of it. Is it here to stay?
In any case, it works wonders for me, thanks again for your valuable insight 🙇♂️
https://github.com/webpack/webpack.js.org/issues/6187