生产
This commit is contained in:
@@ -38,25 +38,28 @@ const config = {
|
|||||||
chunkFilename: "static/css/[name].[contenthash:8].css",
|
chunkFilename: "static/css/[name].[contenthash:8].css",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
// js代码混淆
|
if (process.env.NODE_ENV === "production") {
|
||||||
chain.plugin("obfuscator").use(WebpackObfuscator, [
|
// js代码混淆
|
||||||
{
|
chain.plugin("obfuscator").use(WebpackObfuscator, [
|
||||||
rotateStringArray: true,
|
{
|
||||||
stringArray: true,
|
rotateStringArray: true,
|
||||||
stringArrayThreshold: 0.5, // 降低比例,提高速度
|
stringArray: true,
|
||||||
compact: true,
|
stringArrayThreshold: 0.5, // 降低比例,提高速度
|
||||||
controlFlowFlattening: false, // 关闭,提高速度
|
compact: true,
|
||||||
deadCodeInjection: false, // 关闭,提高速度
|
controlFlowFlattening: false, // 关闭,提高速度
|
||||||
debugProtection: false,
|
deadCodeInjection: false, // 关闭,提高速度
|
||||||
disableConsoleOutput: true,
|
debugProtection: false,
|
||||||
selfDefending: false, // 关闭,提高速度
|
disableConsoleOutput: true,
|
||||||
simplify: true, // 开启简化,提高性能
|
selfDefending: false, // 关闭,提高速度
|
||||||
|
simplify: true, // 开启简化,提高性能
|
||||||
// 禁用对 async/await 的转换
|
// 禁用对 async/await 的转换
|
||||||
target: "browser", // 或设置为适合目标环境的 ECMAScript 版本
|
target: "browser", // 或设置为适合目标环境的 ECMAScript 版本
|
||||||
disableOptimizations: true, // 禁用某些优化来避免处理 async/await
|
disableOptimizations: true, // 禁用某些优化来避免处理 async/await
|
||||||
},
|
},
|
||||||
["**/*.js", "!node_modules/**"], // 避免对 node_modules 进行混淆
|
["**/*.js", "!node_modules/**"], // 避免对 node_modules 进行混淆
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
chain.module
|
chain.module
|
||||||
.rule("markdown")
|
.rule("markdown")
|
||||||
.test(/\.md$/)
|
.test(/\.md$/)
|
||||||
|
|||||||
Reference in New Issue
Block a user