components
components copied to clipboard
Use with webpack loaders (for SVG's as component)
It would be great if this supported your defined custom webpack loaders, so we could use SVG's as components and have them auto imported.
I wish we could do this:
// In template
<template>
<svg-logo/>
</template>
// nuxt.config.js
components: [
{ path: "~/components", extensions: ["vue"] },
{ path: "~/assets/svgs/", prefix: "svg", extensions: ["svg"] }
],
build: {
extend(config, { isDev, isClient }) {
// Add SVG loader
config.module.rules.push({
test: /\.svg$/,
use: [
"babel-loader",
{
loader: "vue-svg-loader",
options: {
svgo: {
plugins: [{ removeViewBox: false }]
}
}
}
]
})
}
Can svgs currently be dynamically / lazy loaded through components ?
@pi0 any tips how how we can or should be using this with SVGs (as Vue components with a loader?)