question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`compiler.watchMode` should be `true` when running `webpack-dev-server`

See original GitHub issue

Bug 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.

  1. create a WebpackPluginInstance that gets passed a Compiler in its WebpackPluginInstance#apply(compiler: Compiler) method.
  2. run webpack serve
  3. the compiler.watchMode is false, yet the watchRun and watchClose hooks are active.

What is the expected behavior?

  1. create a WebpackPluginInstance that gets passed a Compiler in its WebpackPluginInstance#apply(compiler: Compiler) method.
  2. run webpack serve
  3. the compiler.watchMode should be true.

Other relevant information: webpack version: 5.70 Node.js version: 16.13.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ccjmnecommented, Jun 1, 2022

Thank you so much, Alexander!! The shutdown hook 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 🙇‍♂️

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found