-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
CSS with [contenthash] not refreshing with HMR, webpack-dev-middleware #1089
Comments
Please create a github repo with the reproducible example of the problem, thank you |
Thank you so much for taking the time to respond. I created a minimal example here. |
I found the root cause. It breaks when:
It works when:
It seems [contenthash] with hot module reloading does not work. I use content hash to avoid caching of the CSS file. Is there another way I can avoid caching of the css file? I updated the minimal PoC to reflect this. Here too. Attached is a screenshot of the PoC with [contenthash] and a stale CSS payload in hot reload network request. |
Weird, I can't reproduce, even more, we have test cases for this... |
Can you provide full steps using your repo above - https://github.com/YellowSaleTag/hmr-stale-css-payload/? |
Hmm interesting, sure see the following.
|
how did you resolve this problem? I found this problem in my project too |
See these comments / config
Use
as contenthash appears to break...
|
Have you tried generating your own unique hash? https://webpack.js.org/plugins/mini-css-extract-plugin/#filename-option-as-function |
thanks,It's useful for my project |
Bug report
CSS with [contenthash] not refreshing with HMR, webpack-dev-middleware
1. We see our stylesheet loaded in the document with the expected CSS.
2. We make an update to our CSS. We change the
padding
from50
to75
px.3. We see a request in the network tab for the CSS update. However, the contents is stale. It has the old value of
50
px.4. We refresh the page using the refresh button and see the updated value of
75
px.Package Versions
Webpack Config (relevant parts)
Middleware Config
Actual Behavior
padding
from50
to75
px.50
px.75
px.Expected Behavior
How Do We Reproduce?
Minimal configuration provided above for now...
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationThe text was updated successfully, but these errors were encountered: