[vue-svg-icon]! XMLMI loader! Install error

according to the official parlance:

1.install

$ npm install vue-svg-icon --save-dev

my package.json
clipboard.png

2.put your svg into src/svg/
this dir are not supported to be configured now
src folder should be in the same folder with node_modules

:
clipboard.png

3.import vue-svg-icon in your main.js


main.js

clipboard.png

4.use the svg icon in your vue!

:
clipboard.png

OK ...

clipboard.png

:


:


......HOLY

clipboard.png

is there a great god with such a problem? How did you solve it?

Mar.04,2021

in main.js Vue.component ('icon', Icon) , try adding this sentence below:

Icon.inject('moreclass');

Note that the file name is the same as the file name in the src/svg directory, but the extension may not be written, and the name of name is also this moreclass

.

does not follow xml-loader
cnpm install xml-loader


I wonder if your problem has been solved? I wish I had created a new svg folder under the src folder. It is the level juxtaposed with components and router (too lazy to type and write the file structure.)


I previously imported this package in main.js, the compilation reported an error, and there is no error prompt, just miraculously normal, the steps are as follows:
1 create a new svg directory in the / src sibling directory and put the icon file inside.

clipboard.png
2 Import libraries in main.js:

import Icon from "vue-svg-icon/Icon.vue";
// Vue.useVue.config.productionTip
Vue.component("icon", Icon);
Vue.use(ElementUI);
Vue.config.productionTip = false;

3 and then use it normally in vue

<icon name="github"></icon>
Menu