简体   繁体   中英

Sencha cmd, closure compiler error: how to locate the offending code

When running Sencha cmd 6.5, and I get the following error:

[ERR] C2001: Closure Compiler Error (Parse error. undefined label "f") -- compression-input:1:4095

How can I locate the code at compression-input:1:4095 ?

This happens when I include a custom javascript file in app.json using:

"js": [
    {
        "path": "app.js",
        "bundle": true
    },{
        "path": "custom.js",
        "includeInBundle": true
    }
],

The error disapears when I remove the reference to custom.js in app.json .

If I interpret the error correctly, it means that closure compiler finds an error on line 1, character 4095 of the compression-input . But the first line of custom.js is not such long.

How can I locate the offending code ?

And by the way, what is an undefined label in closure compiler ?

I had the same issue a year ago, and I was told you cannot locate it from the error message.

Assuming that you have already tried to open your uncompiled project directly in the browser, and not getting a syntax error, there's not much you can do except narrowing it down further by splitting the custom.js content in two parts and check these independently.

In my case it was Ext.define where should have been Ext.create , and the syntax error is thrown because usage of Ext.define is rewritten into other commands during generation of the compression-input . Maybe if you look for this specifically, you can find it.

I faced similar problems too. I disabled compression in app.json file:

"testing": {
   "compressor": {
     //"type": "closure",
     "type": "none",
     "warningLevel": "quiet"
   },
   "output": "...."
}

And I separately checked the output app.js file with the compiler (which can be downloaded):

java -jar closure-compiler-v20210302.jar --js app.js --js_output_file compiled_output.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM