-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Webpack 5 HMR not working for CSS updates #3064
Comments
Do not use |
Just note using |
@alexander-akait: But I didn't use |
I need to look at your configuration, otherwise it is hard to say there is a problem |
@alexander-akait: Lol I just realized that what I already have is (probably) called hot-reload lol. You might see I tag you in another thread comment. |
How did you solve this problem?
|
Without reproducible example I can't say sorry |
This is my config, and unfortunately my HMR doesn't work with css, I use css modules `const path = require('path'); const config = { module.exports = (env, options) => { if (env.analyze) { config.devtool = isProd ? !isProd : 'inline-source-map'; return config; |
@stevenKirill Can you create a github repo, because it is not readable, thank you |
https://github.com/stevenKirill/webpack-example I created the example of my webpack config |
@stevenKirill Please put |
@alexander-akait Here is my package.json https://github.com/stevenKirill/webpack-example/blob/main/package.json For example I have a Component and try to change css modules code and it's fully refresh page Here I try to change background: 'blue' and it's reload page instead of just change my css without reloading |
Because when you change CSS your classes will be changed, so exports will be changed, do you have https://github.com/pmmmwh/react-refresh-webpack-plugin? |
No, I didn't use this plugin, I thought this problem is because of css modules system, am I right ? |
@stevenKirill Yeah, because we export clases, you can change name of class or add a new class or compose with other class (so export value will be other), it is side effects, we can't just hot reload CSS in such case |
Operating System: Linux 5.4.0-66-generic Add support for a HTML 5 History API fallback #74~18.04.2-Ubuntu
Node Version: v12.21.0
NPM Version: 7.5.6
webpack Version: 5.24.3
webpack-dev-server Version: 3.11.2 and 4.0.0-beta.0
Browser: FF 86.0, Brave Version 1.21.73, Chromium Version 87.0.4280.141
This is a bug
This is a modification request
https://github.com/herokunt/hmr-repo-test
Expected Behavior
Updates are applied automatically without page refresh
Actual Behavior
Updates are applied after page refresh
For Bugs; How can we reproduce the behavior?
npm i && npm start
Check browser console and network requests on each update.
Make whatever changes to JS files. It works.
The text was updated successfully, but these errors were encountered: