-
Notifications
You must be signed in to change notification settings - Fork 109
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 changing content when updating Webpack? #519
Comments
Yikes, that is certainly annoying behavior from webpack. Our defaults already use Maybe what we need is optimize.realContentHash. If you can reproduce your problem by redoing the webpack version change, and try it with that setting, that might give confidence that it would have prevented your production issue. We could make it the default for production builds. Presumably webpack doesn't turn it on by default because it makes builds slower, but for production builds we should be emphasizing correctness over speed. |
Thanks, I'll try that and report back. |
I can reproduce the problem without issues (this is with the default ember-auto-import config).
Same chunkhash, different content. Running a diff shows a few changes in object entries ordering like the one in my original post. And the problem indeed disappears when using the following config: autoImport: {
webpack: {
output: {
filename: 'chunk.[id].[contenthash].js'
},
optimization: {
realContentHash: true
}
}
} |
ember-auto-import per default generates files where the fingerprint hash does not neccessarily match the content. I.e. it could be the same despite of changed content or vice versa. See embroider-build/ember-auto-import#519
Per https://webpack.js.org/configuration/output/#template-strings, `contenthash` is based on the final content of the chunk file. Given the same file contents, the filename is guaranteed to be the same. Resolves embroider-build#519
This commit works around a couple of issues in `ember-auto-import` which were causing non-deterministic chunk filenames and content. Deterministic output should improve cache-reusability across deploys. Refs: embroider-build/ember-auto-import#519 embroider-build/ember-auto-import#548 embroider-build/ember-auto-import#478
This commit works around a couple of issues in `ember-auto-import` which were causing non-deterministic chunk filenames and content. Deterministic output should improve cache-reusability across deploys. Refs: embroider-build/ember-auto-import#519 embroider-build/ember-auto-import#548 embroider-build/ember-auto-import#478
I tried this out in #548 to resolve the opposite problem - I was seeing identical chunk content, but the The same filename template and contenthash is used for sourcemaps. So if you do something which changes the I think the module-naming improvements being discussed in #478 and #479 might help to improve the consistency of the |
Hi,
This is not really a bug report, but instead general questioning about how stuff works.
We have an app using
ember-auto-import
2.4.1, and we recently had a production outage when deploying a webpack bump from 5.68.0 to 5.72.0. Insofar as we understand it as of this writing, the root cause was probably some cache layer not properly serving updated assets after deployment.What happened is, after the webpack update, one of the ember-auto-import chunks changed contents but kept the same name. The only changes in the chunk are just reordering of object entries, eg:
The lack of filename change, combined with the very likely cache issue mentioned above and with our use of
ember-cli-sri
, meant that some users where served the updatedindex.html
but the old chunk content (thus failing SRI).We originally expected the filename would change, mistaking what is actually a chunkhash for a fingerprint. Tell me if I understood that part correctly, but it looks to me the chunkhash is just a hash of what the chunk contains in terms of modules and versions, while the fingerprint would be a hash of the actual final content of the file.
We're currently assessing steps to take in order to avoid future occurrences of this issue (one of them being, of course, understand all our cache layers and fix them...), and we would like to maybe enable fingerprinting on those chunks. Is there some way of achieving that by configuring
ember-auto-import
? We're considering using a different chunk filename template, switching tocontenthash
orfullhash
for example, but are those properly computed from the final content of the minified file?Thanks for your insight on this :)
The text was updated successfully, but these errors were encountered: