vbenjs / vite-plugin-svg-icons

Vite Plugin for fast creating SVG sprites.
MIT License
801 stars 109 forks source link

这插件导致项目打包慢了6倍。。。 #112

Open zhoufanglu opened 3 weeks ago

zhoufanglu commented 3 weeks ago

我去除了之后,打包速度从 4min -> 36s.....

zhoufanglu commented 2 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>
HealerLu commented 2 weeks ago

mark