-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Chunks Hash changes every time when using css-modules #582
Comments
@HosseinAgha thanks for issue. Can your provide minimum reproducible test repo? |
I md5 my chuks using |
We recently ran into this same problem. After we implemented code splitting we noticed that chunkhashes were changing will each build. Problem was not fixed by separating out the webpack manifest into it's own file. Problem wound up being css-module hashes. We wound up with temporary fix by using this for file naming instead: This is aesthetically unappealing and adds a lot of characters to the dom. |
@mryarbles Can you create minimum reproducible test repo? |
@evilebottnawi I have created a minimum reproducible test: https://github.com/HosseinAgha/css-loader-chunkhash-problem as you have requested. |
@evilebottnawi I think we can fix this issue by simply adding a module-content based hashing option so classnames don't change on every build. So chunk hash won't change because the files content are fixed. |
you can use 'contenthash',the chunkhash will change if the js content change new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash:8].css')
}), |
@Oscar-ren this is not working as css files content (class) will change on every build when using css modules |
@HosseinAgha sorry for big delay, but problem in Also we have another issue when you build project on |
@evilebottnawi Thank you very much I can confirm it is fixed now. |
What is the current behavior?
using
modules: true
options breaks webpack chunkhash algorithm and generates a new hash for every chunk on every build. This makes long term caching impossible when usingcss-modules
.I also tried
extract-text-plugin
but I get same behaviour.If the current behavior is a bug, please provide the steps to reproduce.
Follow the steps using official webpack caching guide here. create some async chunks and split points. you'll see that each chunk hash only changes if you change your files content. but if you load a css file using
css-modules
that chunk's hash changes on every build.webpack: v2.7.0
css-loader: latest
style-loader: latest
The text was updated successfully, but these errors were encountered: