-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
v4.0.0-beta.0: static.watch
is enabled by default causing liveReload to always reload page on change
#2893
Comments
hm, I think we should disable static by default |
@alexander-akait that would be great, can we include this in the next release? If this is not too complex, I can give it a shot. |
I think we can do it more in |
That makes sense since it's what we have as the example for |
Yes, I will change it in the next release |
@alexander-akait Thanks! |
when watch property is set to true, my project start time has lasted up to 3 minutes. compared with false property of watch, it's 22 seconds... |
@jueinin I think this #2893 (comment) solve your problem too |
Expected Behavior
A bit of background first. I use
react-refresh
in my project. In version 3, when I make a change in my JSX file, the page does not reload as HMR takes place. In version 4, the page proceeds with a full reload, causing me to lose all app states.The doc for v3 mentions that
watchBaseContent
is disabled by default and thus, this effectively meansliveReload=true
does not take any effect.Actual Behavior
When I explicitly set
static.watch=true
in v4, the issue is resolved. I took a look at the recent change and it seems that in v3, we did thiswhereas in v4, we did this
@hiroppy Maybe I misunderstood here, but this will try to get the
watchOptions
config fromwebpack
and thus almost guarantee to be truthy if we're indevelopment
mode. Should we rethink this behavior or clarify it better in the doc/changelog since not everyone useswebpack-dev-server
use it for serving static files?How to Reproduce The Issue
I have a reproducible repo, please take a look at this PR. After upgrading to
webpack-dev-server@4.0.0-beta.0
. If you run the app usingyarn start
and try to hit the+
button a few time to increase the age, then you try to make some trivial change inApp.tsx
the page is reloaded, and the age is reset to10
.On the other hand, if we add the following to
devServer
section inwebpack.config.js
, things will behave as expected:The text was updated successfully, but these errors were encountered: