Something, somewhere in our code or third-party libraries or who-knows-where, is making uglifyJS unhappy – “ember build --environment production” fails with:
Build failed.
Unexpected token: eof (undefined)
Error
at new JS_Parse_Error (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:189:18)
at js_error (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:197:11)
at croak (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:657:9)
at token_error (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:665:9)
at unexpected (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:671:9)
at block_ (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:977:28)
at ctor.body (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:951:25)
at function_ (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:956:15)
at expr_atom (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:1159:24)
at maybe_unary (/Users/daniel/SourceHG/myproject/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/lib/parse.js:1328:19)
How do I go about finding out where the problem actually is? It builds okay in our CI environment, but if I do the same steps locally (fresh clone of the code, fresh npm install/bower install), it fails like this, and the error message tells me nothing about where I need to look to work out what is making uglify die.