I got Uncaught SyntaxError: Unexpected token ... in some browsers, like Chrome58, is it a way to use a compatible version?
same problem
Same problem
+1
+1 😿,害我找了好久
I just fork the loader, update code manually, remove the unwanted syntax, or use another loader which I found it pass the code to vue-loader for further compile.
It can be fixed by configuring vue.config.js file correctly, I will paste my solution code later.
In vue.config.js fix like this.
const svgRule = config.module.rule('svg');
svgRule.uses.clear();
svgRule
.use('babel-loader')
.loader('babel-loader')
.end()
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: {
plugins: [
{ removeDoctype: true },
{ removeComments: true },
{ removeViewBox: false }
],
removeViewBox: false,
},
})
.end()
Thx!
btw what does svgo mean
@GodofHope svgo is an svg optimizer. https://github.com/svg/svgo
I think @youcanping's config should really be very prominent in the docs, so I added it to the README, see pull request https://github.com/visualfanatic/vue-svg-loader/pull/93
Most helpful comment
In vue.config.js fix like this.