Open ArTiSTiX opened 2 years ago
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.
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.
When using option
appendHash: true
, Webpack 5 throws the following error: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. https://github.com/patrickhulce/fontmin-webpack/blob/fcfcad4fcab486c385cf0a314ca6566efddedb54/lib/index.js#L229