Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing seems to disable file watching / hot reloading #1744

Closed
1 of 2 tasks
kaiyoma opened this issue Mar 27, 2019 · 19 comments
Closed
1 of 2 tasks

Nothing seems to disable file watching / hot reloading #1744

kaiyoma opened this issue Mar 27, 2019 · 19 comments

Comments

@kaiyoma
Copy link

kaiyoma commented Mar 27, 2019

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

  • This is a bug
  • This is a modification request

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:

  • Setting hot: false
  • Setting inline: false
  • Removing HotModuleReplacementPlugin from my list of plugins
  • Unsetting publicPath (which actually breaks the UI entirely)
  • Setting watch: false

And 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?

@alexander-akait
Copy link
Member

It is impossible, don't use webpack-dev-server if you don't want reloading

@alexander-akait
Copy link
Member

Why do you want disable hot/watch ?

@kaiyoma
Copy link
Author

kaiyoma commented Mar 27, 2019

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.

@kaiyoma
Copy link
Author

kaiyoma commented Mar 27, 2019

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.

@alexander-akait
Copy link
Member

Read documentation - it is for webpack --watch, webpack --watch !== webpack-dev-server

@alexander-akait
Copy link
Member

alexander-akait commented Mar 27, 2019

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.

@kaiyoma
Copy link
Author

kaiyoma commented Mar 27, 2019

Okay, that's what I was afraid of. Thanks, I'll look into that.

@alexander-akait
Copy link
Member

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

@alexander-akait
Copy link
Member

If you provide link/minimum reproducible test repo i can look what is wrong.

@kaiyoma
Copy link
Author

kaiyoma commented Mar 27, 2019

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.

@alexander-akait
Copy link
Member

@kaiyoma can you create minimum reproducible test repo?

@kaiyoma
Copy link
Author

kaiyoma commented Mar 27, 2019

I can try. I'll let you know if I can.

@kaiyoma
Copy link
Author

kaiyoma commented Apr 18, 2019

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

@alexander-akait
Copy link
Member

@kaiyoma What do you mean? I can't understand what you want? Just use webpack watch

@kaiyoma
Copy link
Author

kaiyoma commented Apr 19, 2019

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: #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.

@alexander-akait
Copy link
Member

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

@kaiyoma
Copy link
Author

kaiyoma commented Apr 19, 2019

Great, thanks! It sounds like there's already a PR in the works, so I'll wait for that.

@alexander-akait
Copy link
Member

Looks PR was abandoned, so feel free to send new PR

@hiroppy
Copy link
Member

hiroppy commented May 16, 2019

fixed via #1889.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants