Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

@svgr/rollup 6 with breaks the default import handled by another plugin #635

Closed
Pierre-Do opened this issue Nov 30, 2021 · 2 comments 路 Fixed by #638
Closed

@svgr/rollup 6 with breaks the default import handled by another plugin #635

Pierre-Do opened this issue Nov 30, 2021 · 2 comments 路 Fixed by #638

Comments

@Pierre-Do
Copy link

Pierre-Do commented Nov 30, 2021

馃悰 Bug Report

Hey, since the version 6 update I'm facing the following issue:

This error is being raised when used with rollup, since version 6, following the Rollup and @rollup/plugin-url documentation

[!] Error: 'default' is not exported by cart.svg, imported by index.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
index.js (1:7)
1: import cartUrl, { ReactComponent as Cart } from './cart.svg';
          ^
2: 
3: export { cartUrl, Cart };
Error: 'default' is not exported by cart.svg, imported by index.js
    at error (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:158:30)
    at Module.error (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:12382:16)
    at Module.traceVariable (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:12767:29)
    at Module.getVariableForExportName (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:12558:35)
    at Module.includeAllExports (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:12612:39)
    at Graph.includeStatements (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:22901:36)
    at Graph.build (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:22816:14)
    at async rollupInternal (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/shared/rollup.js:23423:9)
    at async build (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/bin/rollup:1546:20)
    at async runRollup (/home/pierredo/Dev/svg-import-named/node_modules/rollup/dist/bin/rollup:1730:21)

To Reproduce

Specifying exportType: 'named' as an option doesn't change anything.

Works as expected with "@svgr/rollup": "^5.0.0",. Breaks with "@svgr/rollup": "^6.0.0",

Expected behavior

The bundle should be generated the same way it was with version 5.

Link to repl or repo (highly encouraged)

https://github.com/Pierre-Do/svg-import-named

Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard

## System:
 - OS: Linux 5.15 Linux Mint 20.2 (Uma)
 - CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
 - Memory: 11.40 GB / 31.09 GB
 - Container: Yes
 - Shell: 5.8 - /bin/zsh
## Binaries:
 - Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
 - Yarn: 1.22.15 - /usr/bin/yarn
 - npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
## npmPackages:
 - @svgr/rollup: ^6.0.0 => 6.0.0 
@open-collective-bot
Copy link

Hey @Pierre-Do 馃憢,
Thank you for opening an issue. We'll get back to you as soon as we can.
Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.
If you use SVGR at work, you can also ask your company to sponsor us 鉂わ笍.

@Pierre-Do
Copy link
Author

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants