All threads / How do I set up webpacker for production environment?
Ask A Question


You’re not receiving notifications from this thread.

How do I set up webpacker for production environment?

Dev asked in Rails

Im running my project first on my local machine using Production environment before deploying to production to make sure all is running fine.
im using docker with Rails version 5.2 and webpacker version 5.4.

I cleared the public/assets and public/packs directory then executed the command "RAILS_ENV=production bundle exec rake assets:precompile", it was able to generate and compile the assets however when viewed on the browser, the app returns this errors on the console and the page is broken and not rendering properly.

Sample errors from console:

GET http:// w.local/assets/activestorage.self-1ed4604ac2170045f1ffca4edb81a75246661555e4f9cf682bb8a21825e32e1c.js?body=1 net::ERR_ABORTED 500 (Internal Server Error)

GET http:// w.local/packs/js/modal-5ec40e25a92d9c39b790.js net::ERR_ABORTED 500 (Internal Server Error)

Any suggestion is highly appreciated.
Thank you.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 68,099+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.