{"action":"created","issue":{"url":"https://api.github.com/repos/browserify-rails/browserify-rails/issues/137","repository_url":"https://api.github.com/repos/browserify-rails/browserify-rails","labels_url":"https://api.github.com/repos/browserify-rails/browserify-rails/issues/137/labels{/name}","comments_url":"https://api.github.com/repos/browserify-rails/browserify-rails/issues/137/comments","events_url":"https://api.github.com/repos/browserify-rails/browserify-rails/issues/137/events","html_url":"https://github.com/browserify-rails/browserify-rails/issues/137","id":131067838,"number":137,"title":"rake assets:precompile doesn't work when using ES6","user":{"login":"Rodrigora","id":371053,"avatar_url":"https://avatars.githubusercontent.com/u/371053?v=3","gravatar_id":"","url":"https://api.github.com/users/Rodrigora","html_url":"https://github.com/Rodrigora","followers_url":"https://api.github.com/users/Rodrigora/followers","following_url":"https://api.github.com/users/Rodrigora/following{/other_user}","gists_url":"https://api.github.com/users/Rodrigora/gists{/gist_id}","starred_url":"https://api.github.com/users/Rodrigora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rodrigora/subscriptions","organizations_url":"https://api.github.com/users/Rodrigora/orgs","repos_url":"https://api.github.com/users/Rodrigora/repos","events_url":"https://api.github.com/users/Rodrigora/events{/privacy}","received_events_url":"https://api.github.com/users/Rodrigora/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-02-03T15:59:08Z","updated_at":"2016-02-17T22:36:16Z","closed_at":"2016-02-10T16:11:52Z","body":"Hey Guys,\r\n\r\nI'm struggling to precompile my Javascript files. I already tried the solutions of #133 and #132.\r\n\r\nTo exemplify the issue, I created [this app](https://github.com/Rodrigora/browserify_test). It is a \r\n\"empty\" rails app with browserify-rails gem and 1 JS file using ES6 syntax.\r\n\r\nSome relevant files:\r\n\r\n**package.json**\r\n```\r\n{\r\n  \"name\": \"something\",\r\n  \"dependencies\" : {\r\n    \"browserify\": \"~> 10.2.4\",\r\n    \"browserify-incremental\": \"^3.0.1\",\r\n    \"babelify\": \"^7.2.0\"\r\n  },\r\n  \"license\": \"MIT\",\r\n  \"engines\": {\r\n    \"node\": \">= 0.10\"\r\n  }\r\n}\r\n```\r\n\r\n**config/application.rb**\r\n\r\n`config.browserify_rails.commandline_options = \"-t babelify --extension-'.jsx'\"`\r\n\r\n**app/assets/javascripts/components/hello.jsx**\r\n```\r\n\"use strict\";\r\n\r\nclass Hello {\r\n  constructor() {\r\n    $(window).ready(function() {\r\n      $('body').append('Hello es6!');\r\n    });\r\n  }\r\n}\r\nmodule.exports = Hello;\r\n```\r\n\r\nI'm using `jsx` extension because I intend to add react to this project\r\n\r\nThe error is:\r\n\r\n```\r\nExecJS::ProgramError: Unexpected token: name (Hello) (line: 11569, col: 6, pos: 326687)\r\n\r\nError\r\n    at new JS_Parse_Error (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:11936)\r\n    at js_error (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:12155)\r\n    at croak (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:20622)\r\n    at token_error (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:20759)\r\n    at unexpected (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:20847)\r\n    at semicolon (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:21320)\r\n    at simple_statement (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:24179)\r\n    at /private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:22152\r\n    at /private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:21493\r\n    at block_ (/private/var/folders/xt/853lxmvx7yx2w8v4xyc92t4h0000gn/T/execjs20160203-74579-14fk3xfjs:2659:26198)\r\n  (in /Users/rodrigora/Projects/browserify_test/app/assets/javascripts/application.js)new JS_Parse_Error ((execjs):2659:11936)\r\njs_error ((execjs):2659:12155)\r\ncroak ((execjs):2659:20622)\r\ntoken_error ((execjs):2659:20759)\r\nunexpected ((execjs):2659:20847)\r\nsemicolon ((execjs):2659:21320)\r\nsimple_statement ((execjs):2659:24179)\r\n(execjs):2659:22152\r\n(execjs):2659:21493\r\nblock_ ((execjs):2659:26198)\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:39:in `exec'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:21:in `eval'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:46:in `call'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/uglifier-2.7.2/lib/uglifier.rb:212:in `run_uglifyjs'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/uglifier-2.7.2/lib/uglifier.rb:179:in `compile'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/uglifier_compressor.rb:25:in `evaluate'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/context.rb:197:in `block in evaluate'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:in `each'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:in `evaluate'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/bundled_asset.rb:25:in `initialize'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in `new'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in `build_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/index.rb:94:in `block in build_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/caching.rb:58:in `cache_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/index.rb:93:in `build_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/base.rb:287:in `find_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:in `find_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:211:in `block in find_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:257:in `benchmark'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:210:in `find_asset'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:119:in `block in compile'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in `each'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in `compile'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-2.12.4/lib/rake/sprocketstask.rb:146:in `with_logger'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/bin/ruby_executable_hooks:15:in `eval'\r\n/Users/rodrigora/.rvm/gems/ruby-2.2.4@browserfy/bin/ruby_executable_hooks:15:in `<main>'\r\nTasks: TOP => assets:precompile\r\n(See full trace by running task with --trace)\r\n```"},"comment":{"url":"https://api.github.com/repos/browserify-rails/browserify-rails/issues/comments/185440275","html_url":"https://github.com/browserify-rails/browserify-rails/issues/137#issuecomment-185440275","issue_url":"https://api.github.com/repos/browserify-rails/browserify-rails/issues/137","id":185440275,"user":{"login":"cymen","id":121034,"avatar_url":"https://avatars.githubusercontent.com/u/121034?v=3","gravatar_id":"","url":"https://api.github.com/users/cymen","html_url":"https://github.com/cymen","followers_url":"https://api.github.com/users/cymen/followers","following_url":"https://api.github.com/users/cymen/following{/other_user}","gists_url":"https://api.github.com/users/cymen/gists{/gist_id}","starred_url":"https://api.github.com/users/cymen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cymen/subscriptions","organizations_url":"https://api.github.com/users/cymen/orgs","repos_url":"https://api.github.com/users/cymen/repos","events_url":"https://api.github.com/users/cymen/events{/privacy}","received_events_url":"https://api.github.com/users/cymen/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T22:36:16Z","updated_at":"2016-02-17T22:36:16Z","body":"@jamesfzhang Unfortunately, I don't know. If your immediate goal is to be able to deploy, it might be worth precompiling the assets locally, committing them and making it so Heroku doesn't try to compile them. Just to get it working now. You can precompile them locally by running:\r\n\r\n`bundle exec rails assets:precompile RAILS_ENV=production`\r\n\r\nThat is by memory so good to verify. Then commit `public/assets` -- that might be enough to prevent Heroku from trying to precompile.\r\n\r\nThat is not ideal but at least you would not be blocked."}}