-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@parcel/transformer-svg-react
produces Asset has no content
#5206
Comments
If those 3 errors weren't enough, just moving the SVG file to the same directory changes the error a 4th time 🎉 import Alert from './alert.svg';
console.log(Alert);
|
Side note: I really wish Parcel showed more information about the code it's evaluating, because |
I'm running into the issue from the first reply. Blew away
Neither worked. |
So this is how it should work: {
"extends": ["@parcel/config-default"],
"transformers": {
"*.svg": ["@parcel/transformer-svg-react"]
}
} {
"dependencies": {
"@parcel/transformer-svg-react": "^2.0.0-nightly.2039",
"@primer/octicons": "^11.0.0",
"parcel": "^2.0.0-nightly.415",
"react": "^16.13.1",
"react-dom": "^16.13.1"
}
} import Alert from "@primer/octicons/build/svg/archive-24.svg";
console.log(Alert()); But we don't really run Babel (including jsx) over node_modules, so I'm currently getting an This check prevents node_modules: parcel/packages/transformers/babel/src/jsx.js Lines 40 to 42 in a839a03
And this check should definitely be updated to use
|
Forgot to add that I’m using the new JSX transformer in React, if that affects anything. |
It gives the same error to me too when trying to import an SVG. Is there a fix for this? |
🐛 bug report
I can't import an SVG as a React component using #4108
🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
No error.
Alert
should be a React component😯 Current Behavior
One of these 3 errors, at random
💁 Possible Solution
🔦 Context
I'm just trying to use #4108, as is, to import SVG files and use them as React(ish) components.
💻 Code Sample
Repro.zip
🌍 Your Environment
The text was updated successfully, but these errors were encountered: