Home > OS >  SOLVED: Rails 6, Webpacker, Bootstrap 5, Coffee on Heroku is not working
SOLVED: Rails 6, Webpacker, Bootstrap 5, Coffee on Heroku is not working

Time:11-15

Problem with coffee script on heroku.

At local machine (Ubuntu Linux) all working perfectly, but after deploying changes to Heroku, coffee script stop working, and I can't understand why.

Tried to "reconfigure" webpacker: And tried to: rails assets:clobber, bin/webpack --verbose --profile, RAILS_ENV=production bundle exec rake assets:precompile

  • no luck.

Tried to precompile locally: rake assets:precompile and then push changes to Heroku: git push heroku master

  • no luck.

Tried to precompile remotely on Heroku: heroku run rake assets:clean assets:precompile

  • no luck.

And there is no any errors about coffee in logs via heroku logs --tail...

  • nothing.

When I insert: alert('Some test'); into my app/javascript/packs/application.js it's worked.

P.S. Rails 6 with Webpacker is some kind of quest... I spend a lot of time to understand and trying to enable usual things which earlier worked fine out from the box in Rails 4 or 5... But now it's seems ok.

UPD1: I inserted alert 'test coffee 1' into first string of my init_coffee.coffee and it's worked now, but if I insert some alert after '$(document).on 'turbolinks:load', ->' then nothing happens.

alert 'test coffee 1' # worked
$(document).on 'turbolinks:load', ->
  alert 'test coffee 2' # not worked

UPD2: The coffeescript is not a problem, problem with turbolinks init and any scripts inside that...

Here is my config/webpacker.yml How to disable Rocket Loader on Cloudflare

  • Related