Unknown option '--watch' in 4.5.0
sporto opened this issue · 7 comments
Describe the bug
In version 4.4.0 this works fine
webpack serve --watch
After upgrading to 4.5.0 we get:
[webpack-cli] Error: Unknown option '--watch'
What is the current behavior?
CLI shows error [webpack-cli] Error: Unknown option '--watch'
And dev server fails to run.
To Reproduce
Run webpack serve --watch
Expected behavior
Run the dev server without error
Don't use --watch
with serve
it doesn't make any sense.
@snitin315 What should I use instead?
With serve --watch
the bundle rebuilds on changes. Without it doesn't.
webpack serve
is sufficient it should rebuild after changes.
@snitin315 it doesn't without --watch
as least in 4.4.0. Is this changed in 4.5.0?
Ok, this is a problem with the loader we are using https://github.com/elm-community/elm-webpack-loader
It expects that flag to watch files.
I can confirm that other files like CSS and Typescript work fine without that flag.
I have been trying to fix this loader. But I'm not familiar on how to build webpack loaders.
I can see that this loader uses compiler.options.watch
, to watch files.
https://github.com/elm-community/elm-webpack-loader/blob/master/index.js#L103
I have tried using the webpack serve
and printing the compiler.options
. watch
is always false when using the dev server.
The doc says that watch is on by default.
Is this the right way to do a loader these days? Using compiler.options.watch
? Can you point me in the right direction? Thanks
you can use compiler.watching
to detect watch
(webpack@5)