Zero-dependency webpack loader that turns SVG files into Vue components. This loader doesn't do anything else.
npm install vue-svg-component-loader --save-dev
module.exports = {
module: {
rules: [
{
test: /\.svg$/,
use: [
'raw-loader', // not included, install separately
'svgo-loader', // not included, install separately
'vue-svg-component-loader',
],
},
],
},
};
<template>
<div>
<AppLogo />
</div>
</template>
<script>
import AppLogo from 'path/to/logo.svg';
export default {
components: {
AppLogo,
},
};
</script>