JetBrains / svg-sprite-loader

Webpack loader for creating SVG sprites.
MIT License
2.01k stars 272 forks source link

Fixes source rewrite issue when building in production #476

Closed NielsJanssen closed 2 years ago

NielsJanssen commented 2 years ago

What kind of change does this PR introduce? Bugfix

What is the current behavior? Issue as described in #475, I wish I had found that issue before debugging it myself. 😅

What is the new behavior? Paths are correctly replaced when building for production. Clearing both _valueAsBuffer and _valueAsString seems to do the trick.

Although this might break again in the future as this (and the current) solution seem to modify private properties. A better solution might be to replace the entire module._source with a new RawSource object, though I'm not sure if I could simply create a new RawSource or if that needs a require from somewhere in webpack.

Does this PR introduce a breaking change? No