Closed jkevingutierrez closed 3 years ago
I'm stretched a little thin at the moment so would appreciate a PR to resolve this.
not sure if it's related directly to the compression-webpack-plugin
because I also saw this with just webpack 5 and [contenthash]
being the 20 hash length
removeKeyHash: /([a-f0-9]{20,32}\.?)/gi,
solved it for me in what I think should be a backwards compatible way for a range of 20-32 char hashes. I don't know enough about the hash lengths to say what the minimum should be, but this at least works so if we're happy with that I could try to submit a pr.
svg-spritemap-webpack-plugin
uses a default hash length of 16 characters. I can imagine the hash has to be a certain length to avoid collisions but an exact length of 32 characters seems somewhat arbitrary to me? I'd vote for {12,32}
or {16,32}
to at least solve most issues with existing plugins.
I'm willing to submit a PR @shellscape, but I first want to ensure that you agree with this opinion.
@cascornelissen sounds reasonable to me. will this introduce any breaking changes?
It could, in theory, but that applies to the arbitrary length of 32 as well because any string could match with the regex (as long as it's within the a-z0-9
range). That's why I can imagine there should be a minimum length but I'd guess 16 is safe.
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ
Expected Behavior
Using compression-webpack-plugin with webpack-manifest-plugin and setting the option
removeKeyHash
astrue
should remove hashes from files generated by the compression plugin.Actual Behavior
Files generated by compression-webpack-plugin have hashes in the name of the file:
Additional Information
As per #231 I wasn't able to test it in Manifest version 3.
Also, adding a map like
Fixes the issue, but it would be great if it would be done automatically without having to add a map function.
It would also be great if it could be done automatically independent of the hash size. It should work for
filename: '[name].[hash].js'
and also forfilename: '[name].[hash:8].js'