[Vuejs]-Vue-material not work md-src with custom svg icon

3👍

I ran into this recently; as Leonardo mentioned it was due to the newly-added MIME type check. For some reason, my SVG file was being served up with Content-Type: text/html.

To fix it, I had to change my icons to use require, which (if I understand correctly) causes it to go through a different loader in Webpack which fixes the MIME type. (See here for a bit more info.) Using OP’s example, I would change:

<md-icon md-src="/assets/icons/svg/telegram.svg" />

to

<md-icon :md-src="require('/assets/icons/svg/telegram.svg')" />
👤0x5453

1👍

Leave a comment