File tree 3 files changed +14
-4
lines changed
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## 0.1.1
4
+
5
+ Fix build issue with empty source maps
6
+
3
7
## 0.1.0
4
8
5
9
Initial release
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vite-plugin-fast-react-svg" ,
3
3
"description" : " Turn SVG into React components, without Babel" ,
4
- "version" : " 0.1.0 " ,
4
+ "version" : " 0.1.1 " ,
5
5
"license" : " MIT" ,
6
6
"author" : " Arnaud Barré (https://github.com/ArnaudBarre)" ,
7
7
"main" : " dist/index.js" ,
Original file line number Diff line number Diff line change @@ -14,12 +14,18 @@ export default function svgPlugin(): Plugin {
14
14
return readFileSync ( id . replace ( "?inline" , "" ) , "utf-8" ) ;
15
15
}
16
16
} ,
17
- transform ( code , id ) {
17
+ async transform ( svg , id ) {
18
18
if ( id . endsWith ( ".svg" ) ) {
19
- return transform ( svgToJSX ( code ) , { loader : "jsx" } ) ;
19
+ const { code, warnings } = await transform ( svgToJSX ( svg ) , {
20
+ loader : "jsx" ,
21
+ } ) ;
22
+ for ( const warning of warnings ) {
23
+ console . log ( warning . location , warning . text ) ;
24
+ }
25
+ return code ;
20
26
}
21
27
if ( id . endsWith ( ".svg?inline" ) ) {
22
- const base64 = Buffer . from ( code ) . toString ( "base64" ) ;
28
+ const base64 = Buffer . from ( svg ) . toString ( "base64" ) ;
23
29
return `export default "data:image/svg+xml;base64,${ base64 } "` ;
24
30
}
25
31
} ,
You can’t perform that action at this time.
0 commit comments