【发布时间】:2021-03-13 22:02:25
【问题描述】:
我正在通过 UglifyJS 发送一个脚本,其中包含 optional changing syntax 的几个实例。在浏览器中,这种语法完美无缺。但是,UglifyJS 在文件上产生以下错误:
Parse error at /Users/username/Developer/script.js:84,32
node.children[0]?.tagName === "P";
^
ERROR: Unexpected token: punc «.»
at JS_Parse_Error.get (eval at <anonymous> (/opt/homebrew/lib/node_modules/uglify-js/tools/node.js:18:1), <anonymous>:71:23)
at fatal (/opt/homebrew/lib/node_modules/uglify-js/bin/uglifyjs:428:27)
at run (/opt/homebrew/lib/node_modules/uglify-js/bin/uglifyjs:366:9)
at Object.<anonymous> (/opt/homebrew/lib/node_modules/uglify-js/bin/uglifyjs:275:5)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
我已经浏览了文档,但我不确定要添加哪些参数(如果有的话)来完成这项工作。
【问题讨论】:
标签: javascript uglifyjs