vbenjs / vite-plugin-svg-icons

Vite Plugin for fast creating SVG sprites.
MIT License
819 stars 111 forks source link

vite + ts打包时报错Cannot read property 'replace' of undefined #43

Closed Cheng-x-c closed 1 year ago

Cheng-x-c commented 2 years ago

[vite:svg-icons] Could not load D:/IdeaProjects/blog/vue3-vite-ts-blog/index.html: Cannot read property 'replace' of undefined error during build: TypeError: Could not load D:/IdeaProjects/blog/vue3-vite-ts-blog/index.html: Cannot read property 'replace' of undefined at compilerIcon (D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\vite-plugin-svg-icons\dist\index.js:5316:21) at async getSymbol (D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\vite-plugin-svg-icons\dist\index.js:5282:21) at async compilerIcons (D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\vite-plugin-svg-icons\dist\index.js:5294:9) at async createModuleCode (D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\vite-plugin-svg-icons\dist\index.js:5233:33) at async Object.load (D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\vite-plugin-svg-icons\dist\index.js:5203:31) at async D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\rollup\dist\shared\rollup.js:22176:83 at async Queue.work (D:\IdeaProjects\blog\vue3-vite-ts-blog\node_modules\rollup\dist\shared\rollup.js:21759:32)

Cheng-x-c commented 2 years ago

image image

imizao commented 2 years ago

我也遇到了,应该是版本问题 将package.json -> devDependencies -> "vite-plugin-svg-icons": "1.0.5", 另外 npm install vite-plugin-svg-icons@1.0.5 就可以了!

boai92 commented 2 years ago

我也遇到了,应该是版本问题 将package.json -> devDependencies -> "vite-plugin-svg-icons": "1.0.5", 另外 npm install vite-plugin-svg-icons@1.0.5 就可以了!

我升级了版本也没用呢