cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
207 stars 49 forks source link

contenthash not replacing on watch #180

Closed KarelJanVanHaute closed 2 years ago

KarelJanVanHaute commented 2 years ago

When I do a build my filename becomes something like "sprite.5f98eada63b8943be820.svg". But when I do a watch my filename becomes "sprite.[contenthash].svg".

Expected behavior What I was expecting is also something like "sprite.5f98eada63b8943be820.svg".

Actual behavior It produces this "sprite.[contenthash].svg"

System information System: OS: macOS 11.5.2 CPU: (8) x64 Apple M1 Memory: 81.82 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.2.0 - ~/.nvm/versions/node/v16.2.0/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 7.19.1 - ~/.nvm/versions/node/v16.2.0/bin/npm npmPackages: webpack: ^5.38.1 => 5.38.1 webpack-cli: ^4.7.2 => 4.7.2

cascornelissen commented 2 years ago

I can't seem to reproduce this with the examples in this repository, can you include a reproduction repository?

endze1t commented 2 years ago

Hi @cascornelissen, we are facing the same issue. I've made a test repo to reproduce: https://github.com/endbay/svg-sprite-bug

Just npm run dev, on first generate all is fine. Then just edit something in src/index.js and [hash] will become broken.

KarelJanVanHaute commented 2 years ago

@endbay Thank you for the reproduction.

cascornelissen commented 2 years ago

Thanks for the reproduction repository, I was away for the weekend but will look into this when I find some time ✌🏼

If anyone is interested in diving it to this and submitting a PR, feel free to!

cascornelissen commented 2 years ago

This should be fixed with 10ac035, can one of you verify this by installing the plugin directly from GitHub before I push out a release?

npm install cascornelissen/svg-spritemap-webpack-plugin#master
KarelJanVanHaute commented 2 years ago

@cascornelissen In my use case it works now. Thank you.

cascornelissen commented 2 years ago

Great to hear, thanks for reporting back! The fix has been released in 4.3.3 🚀