Open zhoufanglu opened 3 weeks ago
vite环境下这样动态引入svg就行,插件已经剔除
const icon = ref();
const getPath = async () => {
const path = `你的本地路径`;
const { default: svg } = await import(path + "?raw");
icon.value = svg;
};
getPath();
<template>
<i :style="iconStyle" v-html="icon" v-if="icon"></i>
</template>
mark
我去除了之后,打包速度从 4min -> 36s.....