javascript-obfuscator配置安装
安装命令:npm install -g javascript-obfuscator
config.json配置文件:
{
"compact": true,
"controlFlowFlattening": true,
"controlFlowFlatteningThreshold": 1,
"deadCodeInjection": true,
"deadCodeInjectionThreshold": 0.4,
"debugProtection": true,
"debugProtectionInterval": true,
"disableConsoleOutput": true,
"identifierNamesGenerator": "hexadecimal",
"numbersToExpressions": true,
"renameGlobals": false,
"selfDefending": true,
"stringArray": true,
"stringArrayEncoding": ["base64"],
"stringArrayThreshold": 1,
"transformObjectKeys": true,
"unicodeEscapeSequence": false
}执行命令示例:
javascript-obfuscator Scripts/mytest.js --output Scripts/mytest.ob.js --config config.json
在 PowerShell 窗口执行需要开启执行权限命令:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
如下图:

config.json文件要在当前执行目录为同级目录