-
Notifications
You must be signed in to change notification settings - Fork 86
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
Vuecli 5.x support #185
Comments
try something like this: config.module.rules.delete('svg')
config.module
.rule('svg')
.test(/\.(svg)(\?.*)?$/)
.use('vue-loader')
.loader('vue-loader')
.end()
.use('vue-svg-loader')
.loader('vue-svg-loader') |
@CcrisS Thanks, bro. It works |
It doesn't work for me. @CcrisS are you able to help? This is what my entire
|
This solution works for me. |
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule.oneOf("inline")
.type('javascript/auto')
.resourceQuery(/inline/)
.use('vue-loader')
.loader('vue-loader')
.end()
.use('vue-svg-loader')
.loader('vue-svg-loader'); try this |
I use this config for my project, the basic idea to import svg as a component by using query parameters, for example Example: import LogoIcon from "/img/logo.svg?vue-component";
chainWebpack: (config) => {
const svgRule = config.module.rule('svg');
// Remove regular svg config from root rules list
config.module.rules.delete('svg');
config.module.rule('svg')
// Use svg component rule
.oneOf('svg_as_component')
.resourceQuery(/vue-component/)
.test(/\.(svg)(\?.*)?$/)
.use('babel-loader')
.loader('babel-loader')
.end()
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: {
plugins: [
{ prefixIds: true },
{ cleanupIDs: true },
{ convertShapeToPath: false },
{ convertStyleToAttrs: true }
]
}
})
.end()
.end()
// Otherwise use original svg rule
.oneOf('svg_as_regular')
.merge(svgRule.toConfig())
.end();
}, |
|
the loader not work in webpack5 environment
The text was updated successfully, but these errors were encountered: