You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportType doesn't seems to be supported. 3 years ago I was using webpack it wasn't supported, 3 years later, I use vite (and so rollup.js) and exportType still isn't supported.
To Reproduce
Expected behavior
I expect to get a the component as default export, so that I'm not forced to use the long boilerplate "import {ReactComponent as My_svg} ...
The text was updated successfully, but these errors were encountered:
Understood.
The vite asset loader loads an asset by default exporting the url.
And svgr doesn't support enforcing the default export. see here.
This line should be if (opts.exportType!=="default" && (opts.state.caller?.previousExport || opts.exportType === 'named')) {
Or maybe it's by design, but right now I can't see any justification for this.
If it's by design and won't be fixed, then those who want the default export feature can:
git clone svgr
modify the line in ./packages/babel-plugin-transform-svg-component/src/variables.ts
cd ./packages/rollup
pnpm link --global
and wherever they want this feature: pnpm link --global @svgr/rollup
Then to replace all the named imports to default imports, you can use this regexp:
pattern: import \{ReactComponent as ([^}]*)}
replace: import $1
🐛 Bug Report
exportType doesn't seems to be supported. 3 years ago I was using webpack it wasn't supported, 3 years later, I use vite (and so rollup.js) and exportType still isn't supported.
To Reproduce
Expected behavior
I expect to get a the component as default export, so that I'm not forced to use the long boilerplate
"import {ReactComponent as My_svg} ...
The text was updated successfully, but these errors were encountered: