Closed 4everTonyStark closed 8 months ago
After reading through the library more today, I've discovered the cause of the issue and the fix for it: the 'build' plugin's transform
regex is looking for __spritemap
with a leading /
characater, which I was missing in both my HTML and React component. Adding the leading slash character makes the library replace the /__spritemap
string properly in builds for both HTML and React components. As such, can the README and "basic" demo project be updated to add the leading slash accordingly?
Yes you right, my bad on this one. I will push a readme fix on the next version update.
Thanks for the issue, it was causing also a bug on Vue compilation x). It is now fix on 2.2.0 ^^
When runnning the "basic" demo project locally with
vite dev
, all SVGs load as expected. However, theuse
andimg
examples do not load after runningvite build
followed byvite preview
. Examining the builtindex.html
file shows that the__spritemap
prefix was not replaced with the name of the outputassets/spritemap.<HASH>.svg
file.It also seems that the
__spritemap
prefix is not replaced in React JSX components upon build, although the plugin works when runningvite dev
. My React component is the following: