From 236f30a470b037129c08376991cc70172c7021e8 Mon Sep 17 00:00:00 2001 From: Vicky <10212746+haifeng-jiang@user.noreply.gitee.com> Date: Tue, 17 Nov 2026 16:21:59 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"perf(admin):=20=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=B8=BA=E5=8D=95=E4=B8=80=20vendor=20?= =?UTF-8?q?=E5=9D=97=E5=87=8F=E5=B0=91=E8=AF=B7=E6=B1=82=E6=95=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0c85cbfe7a0aee022c27ba610311089387f34564. --- vite.config.mts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/vite.config.mts b/vite.config.mts index 8613658..81cd64e 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -106,14 +106,13 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { rollupOptions: { plugins: env.VITE_USE_BUNDLE_ANALYZER === 'true' ? [visualizer()] : undefined, // 拆包 - // 依赖全部收进一个 vendor 块:跨境访问时每个 JS 文件都要单独建连, - // 拆得越细越容易踩到握手重传,首屏越慢。 - // 富文本编辑器只在少数页面用,单独成块按需加载。 + // element-plus 必须与 vue 同块:它内部直接引用 vue 的运行时导出, + // 拆成两块会形成 element-plus ⇄ vue-chunks 循环依赖,浏览器里报 + // "Cannot access 'xx' before initialization" 白屏。 output: { - manualChunks(id: string) { - if (!id.includes('node_modules')) return undefined - if (id.includes('@wangeditor')) return 'wang-editor' - return 'vendor' + manualChunks: { + 'vue-chunks': ['vue', 'vue-router', 'pinia', 'vue-i18n', 'element-plus'], + 'wang-editor': ['@wangeditor/editor', '@wangeditor/editor-for-vue'] } } },