docs: 优化分块策略和混淆器注释
This commit is contained in:
parent
84885b7bc8
commit
86f11d42b8
@ -52,9 +52,13 @@ export default (configEnv: ConfigEnv): UserConfigExport => {
|
|||||||
reportCompressedSize: false,
|
reportCompressedSize: false,
|
||||||
/** 打包后静态资源目录 */
|
/** 打包后静态资源目录 */
|
||||||
assetsDir: "static",
|
assetsDir: "static",
|
||||||
/** 分块策略 */
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
|
/**
|
||||||
|
* 分块策略
|
||||||
|
* 1. 注意这些包名必须存在,否则打包会报错
|
||||||
|
* 2. 如果你不想自定义 chunk 分割策略,可以直接移除这段配置
|
||||||
|
*/
|
||||||
manualChunks: {
|
manualChunks: {
|
||||||
vue: ["vue", "vue-router", "pinia"],
|
vue: ["vue", "vue-router", "pinia"],
|
||||||
element: ["element-plus", "@element-plus/icons-vue"],
|
element: ["element-plus", "@element-plus/icons-vue"],
|
||||||
@ -63,12 +67,13 @@ export default (configEnv: ConfigEnv): UserConfigExport => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** 混淆器 */
|
||||||
esbuild: {
|
esbuild: {
|
||||||
/** 在打包代码时移除 console.log */
|
/** 打包时移除 console.log */
|
||||||
pure: ["console.log"],
|
pure: ["console.log"],
|
||||||
/** 在打包代码时移除 debugger */
|
/** 打包时移除 debugger */
|
||||||
drop: ["debugger"],
|
drop: ["debugger"],
|
||||||
/** 在打包代码时移除所有注释 */
|
/** 打包时移除所有注释 */
|
||||||
legalComments: "none"
|
legalComments: "none"
|
||||||
},
|
},
|
||||||
/** Vite 插件 */
|
/** Vite 插件 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user