-
Notifications
You must be signed in to change notification settings - Fork 92
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
Can't get this plugin to work / Don't understand how to use it #67
Comments
My suggestion is to not use webpack aliases at all - either to use the relative paths, or, to use a babel transform for your aliases, so that everything can use it. |
If the relative one didn't work, and the file is actually loaded there, then that's something that we should explore. |
Also saying having issues with this. I'm working within a Rails project and had resolved_paths set to my asset directory. I saw you mention not to use this so I removed it and tried referring to my SVG files relatively but get a webpack warning saying it cannot find the module. |
I worked out why this wasn't working my specific case... basically don't use the rails asset pipeline to load your SVGs, I had to move them into the same directory as my React app and use the relative URL. |
I tried to use relative url also as described above
it also lives inside the same folder as the React app but I still got |
@OZZlE Are you using any other loaders that are targeting SVG files? I had to also add an |
@andrecalvo nope no other loaders targeting |
Ah or I kept |
yes, this approach relies on babel, and you’d want to avoid using the rails asset pipeline for svgs when using it. |
What we had before:
react-svg-loader (400KB(!) minified + gzipped)
webpack.config.js:
In a .jsx file we import svg's like:
What I did to replace
react-svg-loader
withbabel-plugin-inline-react-svg
:webpack.config.js:
.babelrc
The result?: lots of these...:
The text was updated successfully, but these errors were encountered: