From 23d658ef99411d8bb004fab4dc9a0f017f689d87 Mon Sep 17 00:00:00 2001 From: zyronon Date: Sun, 17 Aug 2025 15:09:18 +0800 Subject: [PATCH] fix:icon components not work when import cdn --- index.html | 1 - package.json | 2 +- pnpm-lock.yaml | 67 ++++++++------------------------------------------ vite.config.ts | 42 ++++++++++++++++--------------- 4 files changed, 33 insertions(+), 79 deletions(-) diff --git a/index.html b/index.html index bf448cef..7357ac6f 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,6 @@ Type Words 练习英语 - + + +` + return html.replace('', `${scripts}`) }, - { - name: 'vue-router', - var: 'VueRouter', - path: `https://2study.top/vue-router.global.prod.min.js` - }, - { - name: 'axios', - var: 'axios', - path: 'https://2study.top/axios.min.js' - }, - ], - }) : null + }, + viteExternalsPlugin({ + vue: 'Vue', + 'vue-router': 'VueRouter', + axios: 'axios', + }) + ] : null, ], build: { rollupOptions: { - external: ['build', 'report'].includes(lifecycle) ? ['axios'] : [],// 使用全局的 axios。因为百度翻译库内部用了0.19版本的axios,会被打包到代码里面 + external: isBuild ? ['axios'] : [],// 使用全局的 axios。因为百度翻译库内部用了0.19版本的axios,会被打包到代码里面 } }, define: {