简体   繁体   English

如何将Rails + Webpacker应用程序部署到Heroku?

[英]How to deploy a Rails + Webpacker app to Heroku?

I'm trying to deploy a Rails 5 application to Heroku. 我正在尝试将Rails 5应用程序部署到Heroku。 It's the first time, however, that I added webpack to the equation. 但是,这是我第一次将webpack添加到方程式中。

I've used webpack to add some Vue components when needed. 我已经使用webpack在需要时添加一些Vue组件。 In my local environment everything works very well, however, things don't really go as planned when deploying to Heroku. 在我的本地环境中,一切工作都很好,但是,部署到Heroku时并没有按计划进行。

Precompiling the assets (both from the pipeline and webpack) completes. 对资产的预编译(来自管道和Webpack)完成。 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. 但是,当我启动应该在其中运行Vue的页面时,在控制台中,当浏览器尝试检索预编译的pack / main javascript文件时,我看到404错误。

This is what Heroku logs show: 这是Heroku日志显示的内容:

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. 这是我第一次真正使用webpack进行部署。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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