Closed chipit24 closed 7 years ago
I have the following code inside one of my components:
const shape = require('./shape.svg'); ... <img src={shape}/>
I set my babelrc up to ignore svg files:
"env": { "node": { "plugins": [ [ "babel-plugin-transform-require-ignore", { "extensions": [".scss", ".css", ".svg", ".png"] } ] ] } }
However, I get an error, ./shape.svg should not be assign to variable. When I remove ".svg" from extensions, it gives me a syntax error inside shape.svg.
./shape.svg should not be assign to variable
".svg"
For svg file or png file which is required by webpack loader, prefer to use https://github.com/morlay/babel-plugin-webpack-loaders-inline-exports.
I have the following code inside one of my components:
I set my babelrc up to ignore svg files:
However, I get an error,
./shape.svg should not be assign to variable
. When I remove".svg"
from extensions, it gives me a syntax error inside shape.svg.