0
1

More than 3 years have passed since last update.

ES6構文をRailsでプリコンパイル

Posted at

AWSにRailsアプリをデプロイしようとした時、、、

諸々設定も終盤、EC2へSSHでログインし、Railsアプリをプリコンパイルする

スクリーンショット 2020-01-26 10.46.06.png

はい、怒られました。

原因は

Uglifier::Error: Unexpected token: punc ()). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).

この部分に書いてありますね。
google翻訳先生に聞くと、

「Uglifier :: Error:予期しないトークン:punc())。 ES6構文を使用するには、ハーモニーモードを>Uglifier.new(:harmony => true)で有効にする必要があります。」

なるほど、、、

と言うわけで、

スクリーンショット 2020-01-26 10.48.51.png

config/environments/production.rb
config.assets.js_compressor = :uglifier

これを、、、

スクリーンショット 2020-01-26 10.49.04.png

config/environments/production.rb
 config.assets.js_compressor = Uglifier.new(harmony: true)

こう!

お疲れ様でした。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1