{"action":"created","issue":{"url":"https://api.github.com/repos/meteor/meteor/issues/5387","labels_url":"https://api.github.com/repos/meteor/meteor/issues/5387/labels{/name}","comments_url":"https://api.github.com/repos/meteor/meteor/issues/5387/comments","events_url":"https://api.github.com/repos/meteor/meteor/issues/5387/events","html_url":"https://github.com/meteor/meteor/issues/5387","id":110332529,"number":5387,"title":"ES6 code fails to run in production environment/build","user":{"login":"gabrielalmeida","id":310382,"avatar_url":"https://avatars.githubusercontent.com/u/310382?v=3","gravatar_id":"","url":"https://api.github.com/users/gabrielalmeida","html_url":"https://github.com/gabrielalmeida","followers_url":"https://api.github.com/users/gabrielalmeida/followers","following_url":"https://api.github.com/users/gabrielalmeida/following{/other_user}","gists_url":"https://api.github.com/users/gabrielalmeida/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielalmeida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielalmeida/subscriptions","organizations_url":"https://api.github.com/users/gabrielalmeida/orgs","repos_url":"https://api.github.com/users/gabrielalmeida/repos","events_url":"https://api.github.com/users/gabrielalmeida/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielalmeida/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-10-07T22:39:06Z","updated_at":"2015-10-11T20:44:00Z","closed_at":null,"body":" The app fails with `--production` flag or with `build/bundle` commands, works normally with `meteor run`.\r\n\r\nI'm using `Meteor 1.2.0.2` with `ecmascript` package enabled on the app and all local packages.\r\n\r\n```\r\n$ DEBUG=true meteor --production --verbose\r\n[[[[[ ~/Dev/PageMe ]]]]]\r\n\r\n=> Started proxy.\r\n=> Started MongoDB.\r\nLocal package version is up-to-date: accounts-base@1.2.1\r\n.\r\n.\r\nLocal package version is up-to-date: webapp-hashing@1.0.5\r\n=> Errors prevented startup:\r\n\r\n   While minifying app code:\r\n\r\n   /Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:196:18:\r\n   Unexpected token punc «(», expected punc «:»\r\n   at new JS_Parse_Error\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:196:18)\r\n   at js_error\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:204:11)\r\n   at croak\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:675:9)\r\n   at token_error\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:683:9)\r\n   at expect_token\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:696:9)\r\n   at expect\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:699:36)\r\n   at\r\n   /Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:1252:13\r\n   at\r\n   /Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:722:24\r\n   at expr_atom\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:1182:35)\r\n   at maybe_unary\r\n   (/Users/gbr/.meteor/packages/standard-minifiers/.1.0.1.1kkdd91++os+web.browser+web.cordova/plugin.minifyStd.os/npm/minifiers/node_modules/uglify-js/lib/parse.js:1358:19)\r\n```\r\n\r\nAs far as I could understand Meteor is trying to ```uglify``` untransformed ES6 code before compiling with babel on build step. As \"reproduction\" shows:\r\n\r\nFile `uglifyme.js` has the content(`es6.properties.shorthand` which `ecmascript` enables):\r\n```\r\nvar obj = {\r\n  render() {\r\n    return 'pizza';\r\n  },\r\n};\r\n\r\nconsole.log(obj);\r\n```\r\n\r\n```\r\n$ mkdir ~/Dev/meteor-uglify-error; cd ~/Dev/meteor-uglify-error/\r\n$ npm install meteor-babel\r\nmeteor-babel@0.5.8 node_modules/meteor-babel\r\n├── decamelize@1.0.0\r\n.\r\n.\r\n├── core-js@1.1.4\r\n└── babel-core@5.8.24\r\n\r\n$ npm install uglify-js\r\nuglify-js@2.4.24 node_modules/uglify-js\r\n├── uglify-to-browserify@1.0.2\r\n├── async@0.2.10\r\n├── yargs@3.5.4 (decamelize@1.0.0, camelcase@1.2.1, window-size@0.1.0, wordwrap@0.0.2)\r\n└── source-map@0.1.34 (amdefine@1.0.0)\r\n\r\n$ node\r\n\r\n> var uglify = require('uglify-js')\r\nundefined\r\n> var babel = require('meteor-babel')\r\nundefined\r\n> var file = fs.readFileSync('uglifyme.js')\r\n\r\n> uglify.minify(\"uglifyme.js\")\r\nError\r\n    at new JS_Parse_Error (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:196:18)\r\n    at js_error (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:204:11)\r\n    at croak (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:684:41)\r\n    at token_error (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:688:9)\r\n    at expect_token (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:701:9)\r\n    at expect (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:704:36)\r\n    at /Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:1257:13\r\n    at /Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:727:24\r\n    at expr_atom (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:1187:35)\r\n    at maybe_unary (/Users/gbr/Dev/uglify-test/node_modules/uglify-js/lib/parse.js:1363:19)\r\n\r\n> uglify.minify(babel.compile(file).code, { fromString: true })\r\n{ code: 'var obj={render:function(){return\"pizza\"}};console.log(obj);',\r\n  map: null }\r\n\r\n```\r\n\r\nAs stated above it shows a similar stack trace when trying to `uglify` before compiling with `babel`. Running ```uglify``` from CLI shows the exact same stack trace:\r\n\r\n```\r\n$ uglifyjs uglifyme.js\r\nParse error at uglifyme.js:2,8\r\nUnexpected token punc «(», expected punc «:»\r\nError\r\n    at new JS_Parse_Error (/usr/local/lib/node_modules/uglify-js/lib/parse.js:196:18)\r\n    at js_error (/usr/local/lib/node_modules/uglify-js/lib/parse.js:204:11)\r\n    at croak (/usr/local/lib/node_modules/uglify-js/lib/parse.js:684:41)\r\n    at token_error (/usr/local/lib/node_modules/uglify-js/lib/parse.js:688:9)\r\n    at expect_token (/usr/local/lib/node_modules/uglify-js/lib/parse.js:701:9)\r\n    at expect (/usr/local/lib/node_modules/uglify-js/lib/parse.js:704:36)\r\n    at /usr/local/lib/node_modules/uglify-js/lib/parse.js:1257:13\r\n    at /usr/local/lib/node_modules/uglify-js/lib/parse.js:727:24\r\n    at expr_atom (/usr/local/lib/node_modules/uglify-js/lib/parse.js:1187:35)\r\n    at maybe_unary (/usr/local/lib/node_modules/uglify-js/lib/parse.js:1363:19)\r\n\r\n```\r\n\r\nSimilar to #5362, which indicates that the solution is to use `.jsx` instead of `.js`, but `ecmascript` package should allow `.js` as well.\r\n\r\n> The ecmascript package registers a compiler plugin that transpiles ECMAScript 2015+ to ECMAScript 5 (standard JS) in all .js files. By default, this package is pre-installed for all new apps and packages.\r\n"},"comment":{"url":"https://api.github.com/repos/meteor/meteor/issues/comments/147243922","html_url":"https://github.com/meteor/meteor/issues/5387#issuecomment-147243922","issue_url":"https://api.github.com/repos/meteor/meteor/issues/5387","id":147243922,"user":{"login":"slavik0329","id":379140,"avatar_url":"https://avatars.githubusercontent.com/u/379140?v=3","gravatar_id":"","url":"https://api.github.com/users/slavik0329","html_url":"https://github.com/slavik0329","followers_url":"https://api.github.com/users/slavik0329/followers","following_url":"https://api.github.com/users/slavik0329/following{/other_user}","gists_url":"https://api.github.com/users/slavik0329/gists{/gist_id}","starred_url":"https://api.github.com/users/slavik0329/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slavik0329/subscriptions","organizations_url":"https://api.github.com/users/slavik0329/orgs","repos_url":"https://api.github.com/users/slavik0329/repos","events_url":"https://api.github.com/users/slavik0329/events{/privacy}","received_events_url":"https://api.github.com/users/slavik0329/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T20:44:00Z","updated_at":"2015-10-11T20:44:00Z","body":"Any ideas on how to get it to transpile before hitting uglifyjs? Shouldn't it do this normally? Could it have anything to do with me using .ng.js extensions?"}}