-
Notifications
You must be signed in to change notification settings - Fork 38
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
sentryWebpackPlugin makes webpack forget content hashes #680
Comments
Hi, thanks for writing in! Can you please share a minimal reproduction that we can use to investigate this? Without a full picture, my best guess would be that our plugin injects something that changes on every build dynamically, for instance the release or debugIds.
Removing what? |
Here's a minimal reproduction: And run it on a Gitlab CI/CD process (since this is no problem running locally):
`// plugins: [ // sentryWebpackPlugin({ // project: "XXX", // org: "XXX", // release: process.env.VERSION || "1.0.0", // include: "./dist", // dryRun: true, // Set to true for testing without uploading // }), // ],`
My short reference above to "Removing, makes it work again:" was to comment away those lines above. Hope this clarifies things. |
Thanks for providing the reproduction! I can in fact reproduce this locally. in the sense that both the First off: It seems fairly logical to me that the Your Webpack plugin config is outdated, probably from a time where you used version 1 of the plugin(?). Here's an updated version: plugins: [
sentryWebpackPlugin({
project: "hbbtv-client",
org: "sveriges-television",
release: {
name: process.env.VERSION || "1.0.0", // <--- `release.name` is the new `release`
}
sourcemaps: { // <-- you probably don't need to set this at all, as we auto detect assets since v2
assets: ["dist"],
},
// dryRun: true, // <-- no longer available
}),
], As you can see, the release name property shifted, which meant that the plugin couldn't determine a set release name so it fell back to either an environment variable or the git commit sha to set it. This release value gets injected into every bundle. So this likely introduced randomness that led to changes in all files. We also further inject a debug id snippet with a unique ID for each file. I think this should be deterministic as long as no file changes occur (cc @lforst to confirm) but likely there was interplay with the release. I recommend updating your config and checking if you still get different hashes in places where you wouldn't expect this. Note that I didn't reproduce this on Gitlab yes because frankly, if I can avoid creating yet another account I'll do that 😅 |
Thank you! That, along with the correct project and auth key, solved the issue. I find it a bit strange that a misconfiguration in the Sentry setup caused the content hashes to change. Is it supposed to work this way? If so, would it be a bad idea to show a warning about it? |
I've updated the code to better split concerns of main.js (index.js) and other.js (other.js) file to better show this in the project linked here: |
Environment
3.1.2
Steps to Reproduce
Expected Result
Should not change on each rebuild.
Actual Result
New dist/static/js/***.bundle.js files every time. Also tried rewrite: true/false to no avail.
The text was updated successfully, but these errors were encountered: