SVGs Not Loading / vue-svg-loader
See original GitHub issue- Laravel Mix Version: 0.7.2
- Node Version (
node -v
): 7.2.0 - NPM Version (
npm -v
): 4.1.1 - OS: OS Sierra
Description:
SVGs are getting dumped into the fonts folder. I’m using the vue-svg-loader
package, and have this rule applied:
{
test: /\.svg$/,
loader: 'vue-svg-loader'
},
in my modules I’m using this: import IconCalendar from '../../../svg/menu circle grid.svg';
error:
[Vue warn]: Invalid Component definition: /fonts/menu circle grid.svg?3644f1f735844b4b08228cc5b11a4534
(found in component <hey-select> at /Users/nathanaelmoody/Sites/heystack-app/assets/js/components/inputs/Select.vue)
Steps To Reproduce:
- install this: https://github.com/visualfanatic/vue-svg-loader
- add the rule
- try to reference an svg file
Side Question: is there a way to reference everything from the project root? So I don’t have to keep doing ../../../
.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:10
Top Results From Across the Web
Load svg using vue-svg-loader not working #7360 - GitHub
What I did in my case and it works is to remove from the regex the svg extension and then as you did...
Read more >Storybook does not load SVGs in Components of Vue project
@liximomo's answer is almost correct. You should remove svg file from file-loader processing rule, but the rule search condition should be ...
Read more >Using SVG and Vue.js: A complete guide - LogRocket Blog
This is a complete guide to using SVG with Vue, including practical examples and best practices to help you along the way.
Read more >vue-svg-loader
This loader inlines the SVGs which enables you to style aspects like for example stroke/fill color. Optimized. Each SVG you import is optimized...
Read more >Dealing with SVG icons in Vue + Vite - DEV Community
Solution 1: Adding back require() ... Probably the easiest way to fix this is to use vite-plugin-require which adds support for require() to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes that would be fine, but we also want to be able to overwrite the standard loader/configs for a particular type of file. For example, I would like to use this for icon SVGs (not for font SVGs of course…):
Will you proposal be able to handle that as well? (Maybe it is already possible, but it seems that the standard mix webpack config is taking precedence over the webpackConfig.rules that I am writing.)
I work this use inline:require.context(‘!svg-sprite-loader?{“symbolId”:“icon-[name]”}!./svg’, false, /.svg$/);