This commit is contained in:
hackrobot
2025-04-02 06:37:39 -05:00
parent b19329182b
commit bd9794d50f

View File

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