vladshcherbin / rollup-plugin-svg-sprite

Create external svg sprite file from your bundle using Rollup
21 stars 5 forks source link

Sort loaded SVGs for deterministic output #8

Open mhassan1 opened 3 years ago

mhassan1 commented 3 years ago

In the case of many SVGs in a project, the order in which they are completely processed is non-deterministic. This results in a sprites.svg that changes from build to build. In the case of Yarn v2 (when referencing a Git project that is built using this plugin), this breaks the expectation that the expected checksum of the project tarball will not change from one environment to another.

This PR sorts the array of symbols before emitting them to sprites.svg. I have confirmed that repeated builds with this change keep the same checksum.