transfrom function does't work in version 7 #851
-
💬 Questions and HelpI practiced the following example. import { transform } from '@svgr/core'
const svgCode = `
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
</svg>
`
transform(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(
(jsCode) => {
console.log(jsCode)
},
) In version 6, @svgr/core can successfully convert svg to a React component, but in version 7, it failed. A test case is shown below: |
Beta Was this translation helpful? Give feedback.
Answered by
await-ovo
Apr 6, 2023
Replies: 1 comment
-
Because starting with v7, plugin jsx is not included in core by default(https://github.com/gregberge/svgr/releases/tag/v7.0.0), we should install it and specify it in config |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gregberge
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because starting with v7, plugin jsx is not included in core by default(https://github.com/gregberge/svgr/releases/tag/v7.0.0), we should install it and specify it in config