From 86f11d42b813b658e1751f715f3816ab57cb0a79 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Wed, 23 Aug 2023 13:48:33 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96=E5=88=86=E5=9D=97?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E5=92=8C=E6=B7=B7=E6=B7=86=E5=99=A8=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index bef402f..7c6d296 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -52,9 +52,13 @@ export default (configEnv: ConfigEnv): UserConfigExport => { reportCompressedSize: false, /** 打包后静态资源目录 */ assetsDir: "static", - /** 分块策略 */ rollupOptions: { output: { + /** + * 分块策略 + * 1. 注意这些包名必须存在,否则打包会报错 + * 2. 如果你不想自定义 chunk 分割策略,可以直接移除这段配置 + */ manualChunks: { vue: ["vue", "vue-router", "pinia"], element: ["element-plus", "@element-plus/icons-vue"], @@ -63,12 +67,13 @@ export default (configEnv: ConfigEnv): UserConfigExport => { } } }, + /** 混淆器 */ esbuild: { - /** 在打包代码时移除 console.log */ + /** 打包时移除 console.log */ pure: ["console.log"], - /** 在打包代码时移除 debugger */ + /** 打包时移除 debugger */ drop: ["debugger"], - /** 在打包代码时移除所有注释 */ + /** 打包时移除所有注释 */ legalComments: "none" }, /** Vite 插件 */