peek / peek-performance_bar

Take a peek into the window.performance timing behind your Rails app.
MIT License
57 stars 20 forks source link

v1.3 is written with ES6 and no longer compiles in a "standard" Rails 4 app #29

Open svyatov opened 7 years ago

svyatov commented 7 years ago

It's somewhat OK, but I think it's worth mentioning in changelog and readme files. I spent quite some time debugging it after gem update. The error wasn't that straightforward:

ExecJS::RuntimeError: SyntaxError: Unexpected token: name (PerformanceBar) (line: 358, col: 6, pos: 12943)

Error
    at new JS_Parse_Error (/tmp/execjs20171106-3876-1k89ds2js:3623:11948)
    at js_error (/tmp/execjs20171106-3876-1k89ds2js:3623:12167)
    at croak (/tmp/execjs20171106-3876-1k89ds2js:3623:22038)
    at token_error (/tmp/execjs20171106-3876-1k89ds2js:3623:22175)
    at unexpected (/tmp/execjs20171106-3876-1k89ds2js:3623:22263)
    at semicolon (/tmp/execjs20171106-3876-1k89ds2js:3623:22781)
    at simple_statement (/tmp/execjs20171106-3876-1k89ds2js:3623:25959)
    at /tmp/execjs20171106-3876-1k89ds2js:3623:23747
    at /tmp/execjs20171106-3876-1k89ds2js:3623:22954
    at /tmp/execjs20171106-3876-1k89ds2js:3624:3759
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
croak ((execjs):3623:22038)
token_error ((execjs):3623:22175)
unexpected ((execjs):3623:22263)
semicolon ((execjs):3623:22781)
simple_statement ((execjs):3623:25959)

And just a suggestion: please reverse the order in your changelog files across all peek gems. A common practice suggests that versions should go in descending order. Then the most recent changes are always at the top which is much more convenient. Examples: https://github.com/rails/webpacker/blob/master/CHANGELOG.md https://github.com/rspec/rspec-core/blob/master/Changelog.md https://github.com/thoughtbot/factory_bot_rails/blob/master/NEWS https://github.com/mperham/sidekiq/blob/master/Changes.md https://github.com/plataformatec/devise/blob/master/CHANGELOG.md

Anyway, thank you for peek, it's awesome and we use it everyday. Let me know if I can help with any of these issues I mentioned above.

RigoOnRails commented 6 years ago

Just had this error right now. Worked well in development but gave me an error as I was deploying. I wonder if there's any gem that could take care of this?

tisba commented 6 years ago

@svyatov did you found a workaround, or did you just downgrade?

CHTJonas commented 5 years ago

For a standard Rails 5 app this can be remedied by editing config/environments/production.rb and replacing

config.assets.js_compressor = :uglifier

with

config.assets.js_compressor = Uglifier.new(harmony: true)