Skip to content
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

[WEBPACK5] appendHash: true - HookWebpackError: Cannot add property integrity, object is not extensible #56

Open
ArTiSTiX opened this issue Mar 15, 2022 · 2 comments

Comments

@ArTiSTiX
Copy link
Contributor

ArTiSTiX commented Mar 15, 2022

When using option appendHash: true, Webpack 5 throws the following error:

HookWebpackError: Cannot add property integrity, object is not extensible

I cannot have a stacktrace of the error, but it might be due to the way the asset is "renamed", webpack might keep a track of the previous asset even if deleted.

delete compilation.assets[file.asset]

@ArTiSTiX
Copy link
Contributor Author

ArTiSTiX commented Mar 15, 2022

Webpack 5 seems to provide compilation methods like deleteAsset or maybe more accurately for this plugin, updateAsset. I think asset should not change name, but just have its infos with hash updated.
I cannot check if the current solution would work (we depends on a manifest with the original asset path to import the font through sass).

Note that we also use another plugin, WebpackManifestPlugin which my rely on another set of asset where the deleted ones still exists - refers to the unhashed name.

@ArTiSTiX
Copy link
Contributor Author

Finally, after testing with webpack5, it seems like appendHash is no longer necessary, since optimizations in production mode recalculates realContentHash based on output content (instead of source).

If no fix planned for Webpack 5 compatibility of this option, you can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant