![](/img/trans.png)
[英]Sencha Cmd, C2001 closure compiler error: extending native class: Array
[英]Sencha cmd, closure compiler error: how to locate the offending code
運行 Sencha cmd 6.5 時,出現以下錯誤:
[ERR] C2001:閉包編譯器錯誤(解析錯誤。未定義標簽“f”)--compression-input:1:4095
如何在compression-input:1:4095
處找到代碼?
當我使用以下命令在app.json
包含自定義 javascript 文件時會發生這種情況:
"js": [
{
"path": "app.js",
"bundle": true
},{
"path": "custom.js",
"includeInBundle": true
}
],
當我刪除custom.js
中對custom.js
的引用時,錯誤app.json
。
如果我正確解釋了錯誤,則意味着閉包編譯器在compression-input
第 1 行第 4095 行發現錯誤。 但是custom.js
的第一行並沒有那么長。
我怎樣才能找到有問題的代碼?
順便說一句,閉包編譯器中的undefined label
是什么?
一年前我遇到了同樣的問題,有人告訴我你無法從錯誤消息中找到它。
假設您已經嘗試直接在瀏覽器中打開未編譯的項目,並且沒有收到語法錯誤,那么除了通過將 custom.js 內容分成兩部分來進一步縮小范圍並獨立檢查這些內容之外,您無能為力。
在我的情況下,它是Ext.define
,其中應該是Ext.create
,並且拋出語法錯誤,因為在生成compression-input
期間將Ext.define
使用重寫為其他命令。 也許如果你專門尋找這個,你可以找到它。
我也遇到過類似的問題。 我在 app.json 文件中禁用了壓縮:
"testing": {
"compressor": {
//"type": "closure",
"type": "none",
"warningLevel": "quiet"
},
"output": "...."
}
並且我用編譯器(可以下載)單獨檢查了輸出的 app.js 文件:
java -jar closure-compiler-v20210302.jar --js app.js --js_output_file compiled_output.js
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.