Open devatrox opened 3 years ago
I guess that's because it's converting the SVG to JSX, but JSX is not allowed inside node_modules...
I guess that's because it's converting the SVG to JSX, but JSX is not allowed inside node_modules...
Is there a workaround other than copying the SVG to the src folder?
Isn't there a react package for this?
@sznowicki Octicons was just an example I used to illustrate it easily. If there happens to be a React library that is great, but it doesn't solve the actual issue for cases where there is no React library.
I'm having the same problem. As soon as parcel wants to read the .svg from node_modules it throws me that message:
@parcel/transformer-js: Expected ;, got height
....path/to/node_modulesfile...
2 | <svg width="32px" height="36px" viewBox="0 0 32 36" version="1.
> 3 | nu" stroke="none" stroke-width="1" fill="none" fill-rule="eveno
> | ^^^^^^
here a small part of the svg:
<svg width="32px" height="36px" viewBox="0 0 32 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Menu" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="BD/Dashboard" transform="translate(-20.000000, -743.000000)">
....
For me it looks like the parameters in the svg tag can't be read but i am not sure, just a theory.
So there's no workaround for this at the moment?
@devongovett
I guess that's because it's converting the SVG to JSX, but JSX is not allowed inside node_modules...
Why would you do that?
If a node module contains .jsx
files, then they should be treated as such, ignoring their location in the file system.
fwiw, I experienced this bug when importing css from node_modules. The css in question has a url to an svg which triggers this bug.
I guess that's because it's converting the SVG to JSX, but JSX is not allowed inside node_modules...
Hey do we have a follow up on this? Is it still block with parcel 2.11 ? π€
π bug report
I'm trying to use an external SVG file from node_modules but it gives the error
@parcel/transformer-js: Expected ;, got xmlns
or something similar. The same does not happen when importing SVGs from the src folder. The whole thing used to work without problems before I switched to Parcel 2.π Configuration (.babelrc, package.json, cli command)
π€ Expected Behavior
No error, an SVG is displayed.
π― Current Behavior
An error is displayed in the shell
π Possible Solution
π¦ Context
π» Code Sample
I created a sample repo: https://github.com/devatrox/svg-test
π Your Environment