esbuild-plugin-svgr
esbuild-plugin-svgr copied to clipboard
SVG paths are not resolved
I have a scss file that looks like this:
index.scss
body {
background-image: url(@src/logo.svg);
}
When I build the project, the resulting css file will contain the same @src/logo.svg
url, which is invalid.
Note that I have configured esbuild and the sassPlugin to resolve @src
to the correct path.
Also note that a similar thing happens in the following case:
index.jsx
import Logo from "@src/logo.svg?url";
The resulting index.js
file will contain @src/logo.svg
(which is incorrect).
The correct behaviour would be to resolve the path to its final path. Eg, if my esbuild config is
assetNames: "[dir]/[name].[hash]",
then the url should look like /logo.8Fgx1Fgm.svg