(已解决)记一次 RAILS_ENV=production bundle exec rails assets:precompile 出错的解决方案

uglifier 不支持 ES6。所以 production 环境下一跑 rails assets:precompile 就出错

简单说就是不要用 ES6 的语法。因为 uglifier 不支持 ES6。
所以一跑RAILS_ENV=production bundle exec rails assets:precompile
就出问题。

最后定位到问题是

setTimeout(() => {
  jQuery('#app').addClass('event_open');
}, 1000);

正确的写法如下

setTimeout(function(){
  jQuery('#app').addClass('event_open');
}, 1000);

区别点是 ()=>换成了function(){
浪费了接近1个下午时间。诶。

我也写到这里了:
https://ruby-china.org/topics/34280