在option中增加 reservedNames: ['^globalVariable1$'],假如你想要保留globalVariable1变量名不混淆。
<script type="text/javascript"> const obfuscationResult = JavaScriptObfuscator.obfuscate( ` var you="11"; function test(){ let globalVariable1 = 'This will not be obfuscated'; alert(globalVariable1); } alert(you); var globalVariable1 = 'This will not be obfuscated'; var globalVariable2 = 'This will be obfuscated'; `, { // 正则表达式匹配不被混淆的变量名 reservedNames: ['^globalVariable1$'], compact: false, controlFlowFlattening: true, controlFlowFlatteningThreshold: 1, numbersToExpressions: true, simplify: true, stringArrayShuffle: true, splitStrings: true, stringArrayThreshold: 1, debugProtection: true, debugProtectionInterval: 2, disableConsoleOutput: false, domainLock:[] , domainLockRedirectUrl:'about:blank', } ); console.log(obfuscationResult.getObfuscatedCode()); </script>
网友回复
html中内嵌style与link引入css代码报错的处理机制不同?
coze扣子中调用seadream4多参考图修改ps图片如何返回图片尺寸设为第一个图片的尺寸?
coze扣子中如何将原图缩放到指定尺寸?
如何解决传大文件突然断网重传的问题?
CefSharp与Electron开发桌面应用哪个更好?
在哪可以免费白嫖claude 4.5?
如何编写一个chrome插件实现多线程高速下载大文件?
cdn版本的vue在网页中出现typeerror错误无法找到错误代码位置怎么办?
pywebview能否使用webrtc远程控制共享桌面和摄像头?
pywebview6.0如何让窗体接受拖拽文件获取真实的文件路径?