Why does js/bin/mxmlc take longer than bin/mxmlc?

By default, js/bin/mxmlc not only cross-compiles your MXML and ActionScript source files, it also sends the resulting JavaScript to the Google Closure Compiler (GCC) which builds a minified/optimized version in the bin/js-release folder.  By setting the -debug flag to true, js/bin/mxmlc will skip sending the results to the GCC which can save significant time during development.  Some IDEs set the -debug flag to true by default.  You can tell from the console output whether GCC is running as GCC will add output to the console that looks like:

    Apr 14, 2016 7:38:50 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
    WARNING: 0 error(s), 8 warning(s), 96.45049593731463% typed

Why does the application in bin/js-release not run?

The most common problem is that the Google Closure Compiler found an error when trying to create the minified/optimized version.  Before running the version in bin/js-release, you should verify that in the console output there were no errors.  Some warnings are usually ok.

The second most common problem is that the Google Closure Compiler renames variables when creating the optimized version.  For example, the 'firstName' property on an object might get renamed to be 'a'.  The GCC will change all known accesses to that property to use the variable 'a' as well, but if you have code that is accessing using bracket syntax (obj['firstName') or the property names are set by external sources like server responses, then you will need to make sure the GCC does not rename certain variables.  More on this in a related page.

I got an error of the form: SEVERE: ERROR - Circular dependency detected: DataBindingExample -> controllers.MyController -> DataBindingExample.  Now what?

The Google Closure Compiler will not complete the output of a minified/optimized version if it finds circular dependencies in the output files.   The quickest way to get past this is to add the -remove-circulars compiler option.  See this related page for more information about circular dependencies.


  • No labels