-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Same contenthash, different asset content after running optimization plugins #7483
Comments
Because |
How can it be fixed? Is it a bug in As I understand, webpack is responsible for generating the filename provided to Thank you |
@albertfdp plugin should regenerate |
Thanks for the answer, that makes sense now. |
@evilebottnawi if I wanted to open a PR to fix that myself on the plugin, could you indicate me what is the exposed webpack hook to regenerate the |
@albertfdp need resolve this issue webpack/loader-utils#112 and use this module for generate |
Bug report
What is the current behavior?
Two different builds with different (for example)
postcss
configuration, result into an asset that has different content, but same[contenthash]
, and therefore same filename. This means that if you use a CDN which cached the previous file, and SRI, file integrity will fail.I have opened the issue on NMFR/optimize-css-assets-webpack-plugin#56 but I actually think this might be a webpack bug, as it looks like a plugin is capable of changing the content of the file after this has calculated the
contenthash
.If the current behavior is a bug, please provide the steps to reproduce.
I have created a reproduction repo in https://github.com/albertfdp/optimize-css-assets-plugin-contenthash
The repo uses the recommended configuration on https://github.com/webpack-contrib/mini-css-extract-plugin#minimizing-for-production
There are 2 webpack builds, A and B, the differences are:
Additionally, I am using:
The resulting assets:
What is the expected behavior?
That the
contenthash
is computed after having run the optimization plugins.Other relevant information:
webpack version: 4.10
Node.js version:
Operating System:
Additional tools: https://github.com/albertfdp/optimize-css-assets-plugin-contenthash/blob/master/package.json
The text was updated successfully, but these errors were encountered: