Install svg-inline-loader for webpack :
npm install svg-inline-loader --save-dev
Add it to your loaders in module.loaders section of webpack.config.js:
{
test: /\.svg$/,
loader: 'svg-inline-loader'
}
And now the tricky thing is to modify your vue-loader options to use require for vector:src attribute which will in turn use the svg-inline-loader:
transformToRequire: {
// use for vector:src
vector: 'src',
// img:src & image:xlink:href url transform (vue default)
// https://github.com/vuejs/vue-loader/blob/master/docs/en/options.md
img: 'src', image: 'xlink:href'
}
(optional) Use vector as a top-level component:
import Vector from './Vector'
Vue.component('vector', Vector)
And now in your .vue files you can use it like "traditional" images :
<template>
<div>
<vector src="~assets/my-image.svg"></vector>
</div>
</template>