Skip to content

Commit

Permalink
migrate from google-closure-compiler 20170124 to uglify 2.1.0 because…
Browse files Browse the repository at this point in the history
… of wrong minification of module header by closure compiler

I spend many days of my time in analysing strange errors with the usage of jqGrid modules in SystemJS. The final results were the following: all non-minimized modules of jqGrid were loaded correctly, but some modules (grid.formedit and grid.jqueryui) were not loaded. The reson was the error in google-closure-compiler, which minimize the module headers sometimes incorrectly. As the result, SystemJs loads some modules (grid.formedit and grid.jqueryui only in my tests) with **undefined** `define`. The `Node/CommonJS` part of the module header was used. The part of code set just `module.exports` and expect that the exports be called, but no call take place and thus the `factory` (the main code of the module) will be not executed and the methods of the modules will be not availible. The option `format: "amd"` of SystemJS was used of cause. Loading of non-minimized versions of the same modules was successful.

One can see that new version of google-closure-compiler, which is not yet rereased, introduces new option (flag) `--module_resolution`. On the other side we need just to hold the original module header. The tests of Uglify was very good. The minimized code produced by google-closure-compiler is smaller as by Uglify 2.1, but gziped minimized code is smaller from the code generated by Uglify. Because one will loads mostly only gziped version of minimized code, then Uglify 2.1 is currently better as google-closure-compiler 20170124.

Finally I made the migration from google-closure-compiler 20170124 to uglify 2.1.0.
  • Loading branch information
OlegKi committed Feb 23, 2017
1 parent 1c740d0 commit a385f56
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 224 deletions.
Loading

0 comments on commit a385f56

Please sign in to comment.