Closed tomwayson closed 8 years ago
You can set the build profile's optimizeOptions
property to set closure to use ES5 like this:
optimizeOptions: {
// http://mail.dojotoolkit.org/pipermail/dojo-interest/2014-October/082561.html
languageIn: Packages.com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT5
}
Thanks @dasa! I'll give that a try.
Just realizing that my uglify build of the dojo-boilerplate may have also hanged (I've got too many console windows open and may have been confused about which builds worked/failed). I'm re-trying now. If that's the case, it means the issue is w/ Dojo, and not the JSAPI files on bower.
@dasa
FYI - the above optimizeOptions
does not work for me (at least not from grunt dojo
on Windows). Following the link to the mailing list, I realized that this was one of the things I hard already tried. I get this error:
error(347) Failed to evaluate profile file. profile: c:/code/git/BayerCropScience/profiles/app.profile.js; error: ReferenceError: Packages is not defined
error(347) Failed to evaluate profile file. profile: c:/code/git/BayerCropScience/profiles/app.profile.js; error: ReferenceError: Packages is not defined
errors on command line; terminating application.
Changing that to a string like:
optimizeOptions: {
// http://mail.dojotoolkit.org/pipermail/dojo-interest/2014-October/082561.html
languageIn: 'Packages.com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT5'
},
Also fails w/ repeated entries in the output of following error:
OPTIMIZER FAILED: InternalError: Cannot convert Packages.com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT5 to com.google.javascript.jscomp.CompilerOptions$LanguageMode
Yes, I think this option is only available when running the build from build.bat or build.sh and not when launched from Node.js.
Thanks @dasa - I'll try running the build from a terminal instead of grunt.
I'm closing this issue as I've confirmed that setting optimize
to 'uglify' in the dojo-boilerplate repo causes the build to hang as well. I've opened a (duplicate) issue there:
The closure compiler is less desirable b/c it is slower, requires Java, defaults to ES3 mode (and I've not found any examples that successfully demonstrate how to pass an option to tell it to use ES5 from the dojo build). For those reasons, I'd rather use uglify to compile my JS files, but it seems to hang forever w/ any build that includes the ArcGIS JS API files from bower.
Steps to reproduce:
cd
into bower/dojo folder and follow all install/build instructions to verify that it worksnpm install --save-dev uglify-js@1
optimize
andlayerOptimize
options in build.profile.js to use 'uglify' instead of 'closure'npm run clean
andnpm run build
the script will hang during the optimization step.I've seen this before w/ the slurp files. However I can run the dojo-boilerplate (with no esri modules) w/ those both set to 'uglify' and it works. Furthermore, it also works to just set
layerOptimize
to 'uglify' and leaveoptmize
set to 'closure'. To me, that means that there's something that is incompatible w/ the uglify compiler in (at least one of) the minified files that is not part of any build layer.