-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
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-next.77 hot reloading regression from v3 #9523
Comments
Alrighty, here's a minimal reproduction. Pretty simple: https://github.com/kentcdodds/react-scripts-hot-reloading-raw-loader // eslint-disable-next-line import/no-webpack-loader-syntax
import html from '!raw-loader!./example.html'
document.body.innerHTML = html I realize that there is no intended support of |
I have had a quick look in the original mentioned repository and when I add a bunch of logs left and right. Looks like the change is detected but because the status of HMR is
is triggered so the function is exited because canApplyUpdated() returns false so it enters this if-block. I am not sure why the status is Some of the logs which get triggered when changing the html file and then save it:
|
Following on from @weyert 's excellent detective work, here's the error that is causing the
It could just be that as you theorize, |
raw-loader was supported in previous versions, so if it's no longer supported that's either a regression or a breaking change. (Not a breaking change for CRA because technically inline loaders isn't supported. I mean a breaking change for raw-loader or webpack). |
a little workaround is to use this if (module.hot) {
module.hot.accept()
} in your Maybe the problem is causing by the new webpack plugin that CRA is using fast-refresh |
Considering inline loaders aren't technically supported, that's a satisfactory solution. Thanks @marcofugaro! |
Describe the bug
I have an app where I dynamically import an HTML file and load that into the document. In version 3, changing the HTML file would trigger a refresh no problem, but in version 4 that no longer happens.
Interestingly it does recompile (the output changes to "Compiling..." for a moment) on save, but the new content is not available.
Did you try recovering your dependencies?
Which terms did you search for in User Guide?
Fast refresh, hot reloading
Environment
Steps to reproduce
I'm still working on a simple way to reproduce. Will update this here soon.
Expected behavior
I expect changing the file to trigger a refresh of the browser
Actual behavior
Nothing on the page changes until I refresh the browser manually
Reproducible demo
https://github.com/kentcdodds/react-fundamentals
src/exercise/01.html
The text was updated successfully, but these errors were encountered: