File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -11,20 +11,21 @@ export default function svgrPlugin(): Plugin {
11
11
const { default : convert } = await import ( '@svgr/core' )
12
12
13
13
const svgCode = await fs . promises . readFile ( id , 'utf8' )
14
- const componentCode = await convert (
14
+ let componentCode = await convert (
15
15
svgCode ,
16
16
{ } ,
17
17
{ componentName : 'ReactComponent' }
18
18
)
19
- code =
20
- code +
21
- '\n' +
22
- componentCode . replace (
23
- 'export default ReactComponent' ,
24
- 'export { ReactComponent }'
25
- )
19
+ componentCode = componentCode . replace (
20
+ 'export default ReactComponent' ,
21
+ 'export { ReactComponent }'
22
+ )
26
23
27
- const res = await transformWithEsbuild ( code , id , { loader : 'jsx' } )
24
+ const res = await transformWithEsbuild (
25
+ componentCode + '\n' + code ,
26
+ id ,
27
+ { loader : 'jsx' }
28
+ )
28
29
29
30
return {
30
31
code : res . code ,
You can’t perform that action at this time.
0 commit comments