Jac*_*cob 3 javascript uglifyjs
我正在通过 UglifyJS 发送一个脚本,其中包含一些可选更改语法的实例。在浏览器中,这种语法可以完美地工作。但是,UglifyJS 在文件上产生以下错误:
\nParse error at /Users/username/Developer/script.js:84,32\n node.children[0]?.tagName === "P";\n ^\nERROR: Unexpected token: punc \xc2\xab.\xc2\xbb\n at JS_Parse_Error.get (eval at <anonymous> (/opt/homebrew/lib/node_modules/uglify-js/tools/node.js:18:1), <anonymous>:71:23)\n at fatal (/opt/homebrew/lib/node_modules/uglify-js/bin/uglifyjs:428:27)\n at run (/opt/homebrew/lib/node_modules/uglify-js/bin/uglifyjs:366:9)\n at Object.<anonymous> (/opt/homebrew/lib/node_modules/uglify-js/bin/uglifyjs:275:5)\n at Module._compile (node:internal/modules/cjs/loader:1092:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)\n at Module.load (node:internal/modules/cjs/loader:972:32)\n at Function.Module._load (node:internal/modules/cjs/loader:813:14)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)\n at node:internal/main/run_main_module:17:47\nRun Code Online (Sandbox Code Playgroud)\n我已经浏览了文档,但我不确定要添加哪些参数(如果有)才能完成这项工作。
\nUglifyJS 很可能还不支持可选链接运算符?.。我找不到解析器源代码中列出的运算符。
该工具的作者建议在使用 UglifyJS 之前对具有外来 JS 语法的文件使用 BabelJS 等转译器。
该运算符于 2020 年 6 月被添加到 ECMAScript 标准中(同一??运算符,但对其的支持仅在 18 天前,即 2021 年 2 月 23 日被添加到 UglifyJS 中)。
| 归档时间: |
|
| 查看次数: |
1701 次 |
| 最近记录: |