Operating System: Windows 10
Node Version: 10.15.0
NPM Version: 6.4.1
webpack Version: 4.29.6
webpack-dev-server Version: 3.2.1
How do you disable file watching / hot reloading? I've been banging my head against the wall for a while now, reading various SO threads and GitHub issues, and yet nothing seems to work.
I've tried the following:
hot: falseinline: falseHotModuleReplacementPlugin from my list of pluginspublicPath (which actually breaks the UI entirely)watch: falseAnd yet, every time I save a change to a source file, the dev server rebuilds, messages are sent to the browser console, and (optionally) the page is refreshed.
I really don't understand the last one (watch: false) since it seems like exactly the option I'm looking for, yet it doesn't seem to have any effect. Has anyone actually been able to disable file watching?
It is impossible, don't use webpack-dev-server if you don't want reloading
Why do you want disable hot/watch ?
Then why do you have all the watch options?
https://webpack.js.org/configuration/watch/
Why do you also allow hot reloading to be turned off in the config? This doesn't seem like a satisfactory answer.
We run the dev server as part of our CI. We run Selenium tests against the dev server as part of each commit that's going through review and we also run Selenium tests daily.
We like the dev server because in dev mode, there is extra output to the browser console, like React PropTypes errors and other things of that nature. However, in a CI environment, there clearly won't be any changes to the source files, so we'd like to disable file watching. We've found that the webpack dev server sometimes has a mind of its own and rebuilds when it doesn't need to, like if a file is simply read or touched. Rebuilding causes the UI to refresh, which causes tests to fail.
Read documentation - it is for webpack --watch, webpack --watch !== webpack-dev-server
I think using webpack-dev-server on CI is out of scope this package. Better use own server, as minimum it is faster and flexibility as maximum webpack-dev-server get overhead for testing.
Okay, that's what I was afraid of. Thanks, I'll look into that.
We've found that the webpack dev server sometimes has a mind of its own and rebuilds when it doesn't need to, like if a file is simply read or touched.
Something wrong in you CI setup, webpack doesn't do rebuild if it is unnecessary
If you provide link/minimum reproducible test repo i can look what is wrong.
We've found that the webpack dev server sometimes has a mind of its own and rebuilds when it doesn't need to, like if a file is simply read or touched.
Something wrong in you CI setup, webpack doesn't do rebuild if it is unnecessary
I've found that running Jest (locally) while running the webpack dev server causes the server to rebuild over and over, even though none of the source files are changing.
@kaiyoma can you create minimum reproducible test repo?
I can try. I'll let you know if I can.
@evilebottnawi Is there a way to disable the auto-refresh behavior? I would like webpack-dev-server to rebuild on every file change, but I _don't_ want the page in the browser to refresh until I do it myself. I've tried searching all over but I can't figure out how to do this.
@kaiyoma What do you mean? I can't understand what you want? Just use webpack watch
I would like a way to have a server that serves the files, and I would like the bundle to be rebuilt automatically when a source file is modified, but I _don't_ want the browser to automatically reload the page. I don't think webpack watch alone is enough because I still need a server.
It seems that other people want this too: https://github.com/webpack/webpack-dev-server/pull/1276
It would be nice if there was a way to disable both HMR and automatic page refreshing. Our UI is very expensive to load, so that's why I _don't_ want the page to automatically refresh on every change.
hm, sound reasonable, let's reopen and mark as feature because it is rare use case will be better if you take care about this and send a PR
Great, thanks! It sounds like there's already a PR in the works, so I'll wait for that.
Looks PR was abandoned, so feel free to send new PR
Most helpful comment
We run the dev server as part of our CI. We run Selenium tests against the dev server as part of each commit that's going through review and we also run Selenium tests daily.
We like the dev server because in dev mode, there is extra output to the browser console, like React PropTypes errors and other things of that nature. However, in a CI environment, there clearly won't be any changes to the source files, so we'd like to disable file watching. We've found that the webpack dev server sometimes has a mind of its own and rebuilds when it doesn't need to, like if a file is simply read or touched. Rebuilding causes the UI to refresh, which causes tests to fail.