简体   繁体   中英

How to deploy a Rails + Webpacker app to Heroku?

I'm trying to deploy a Rails 5 application to Heroku. It's the first time, however, that I added webpack to the equation.

I've used webpack to add some Vue components when needed. In my local environment everything works very well, however, things don't really go as planned when deploying to Heroku.

Precompiling the assets (both from the pipeline and webpack) completes. When I start the page where Vue is supposed to be running, however, in the console I see a 404 error when the browser is trying to retrieve the precompiled pack/main javascript file.

This is what Heroku logs show:

2017-10-19T10:04:51.947282+00:00 heroku[router]: at=info method=GET path="/packs/main-49ef6f7f11bf1482d113.js" host=appname.herokuapp.com request_id=fce4e051-2880-4566-8e66-5cd3369a819f fwd="125.227.151.206" dyno=web.1 connect=0ms service=72ms status=404 bytes=1744 protocol=https

No other major error shown in the logs. Do you have any idea of how to solve or where to look for more details?

I apologize if this is a "stupid" question. It's the first time I actually deploy with webpack.

原来,我的合作开发人员将/ public / packs添加到.gitignore,因此该目录未推送到Heroku

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM