diff --git a/CHANGELOG.md b/CHANGELOG.md index 29e891a..1d891fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.1 + +Fix build issue with empty source maps + ## 0.1.0 Initial release diff --git a/package.json b/package.json index e271f49..6c40d60 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vite-plugin-fast-react-svg", "description": "Turn SVG into React components, without Babel", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "author": "Arnaud Barré (https://github.com/ArnaudBarre)", "main": "dist/index.js", diff --git a/src/index.ts b/src/index.ts index 0debeab..bbcf359 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,12 +14,18 @@ export default function svgPlugin(): Plugin { return readFileSync(id.replace("?inline", ""), "utf-8"); } }, - transform(code, id) { + async transform(svg, id) { if (id.endsWith(".svg")) { - return transform(svgToJSX(code), { loader: "jsx" }); + const { code, warnings } = await transform(svgToJSX(svg), { + loader: "jsx", + }); + for (const warning of warnings) { + console.log(warning.location, warning.text); + } + return code; } if (id.endsWith(".svg?inline")) { - const base64 = Buffer.from(code).toString("base64"); + const base64 = Buffer.from(svg).toString("base64"); return `export default "data:image/svg+xml;base64,${base64}"`; } },