In one of my component, I'm trying to load an svg image but vuejs/webpack fails.
Here's my code :
<template>
<img src="../../assets/public/images/sad.svg" />
</template>
<script>
export default {}
</script>
And the error :
ERROR in ./src/assets/public/images/sad.svg
Module parse failed: /home/cabox/workspace/src/assets/public/images/sad.svg Line 1: Unexpected token < You may need an appropriate loader to handle this file type.
|
|
| @ ./~/vue-html-loader!./~/vue-loader/lib/selector.js?type=template&index=0!./src/components/tooltip.vue 1:205-258 1:592-645
From what I understand, Vuejs (or Webpack) tries to interpret the content of .svg. And this is not what I want.
Here's my webpack config for svg :
{ test: "\.svg", loader: "file-loader?mimetype=image/svg+xml" },
Thank you for your help.
svg-loaderinstead offile-loader.Unexpected token < You may need an appropriate loader to handle this file type.