Hyperstack应用程序在Heroku上失败,并显示“ ReferenceError:找不到变量:Hyperstack”

时间:2019-09-13 00:33:20

标签: ruby-on-rails heroku hyperstack

我有一个简单的Hyperstack应用程序在本地工作。

我正在尝试将其部署到Heroku。它显示静态文本,但不显示Hyperstack组件。 Javascript控制台显示ReferenceError: Can't find variable: Hyperstack

在application ... js文件中,其显示为undefined is not an object (evaluating 't.Component')。有什么明显的我想念的吗?

我已经按照https://github.com/hyperstack-org/hyperstack/issues/230上的说明进行操作:

  1. 评论生产警卫
  2. 在异步模式下使用ActionCable
# config/environments/production.rb
Rails.application.configure do
  # [...]
  # Mount Action Cable outside main process or domain
  config.action_cable.allowed_request_origins = ['https://morning-brushlands-37036.herokuapp.com', 'http://morning-brushlands-37036.herokuapp.com']
  config.web_socket_server_url = "wss://morning-brushlands-37036.herokuapp.com/"
  # [...]
end
# config/cable.yml
development:
  adapter: async

test:
  adapter: async

production:
  adapter: async
  # adapter: redis
  # url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
  # channel_prefix: Jiro_production

浏览器控制台中的完整错误为:

Uncaught TypeError: Cannot read property 'Component' of undefined
    at application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:50364
    at OpalLoaded (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:49667)
    at application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:49668
VM23:1 Uncaught ReferenceError: Hyperstack is not defined
    at eval (eval at module.exports (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:28997), <anonymous>:1:1)
    at Object.module.exports [as getConstructor] (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:28997)
    at Object.mountComponents (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:29104)
    at HTMLDocument.handleMount (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:29128)
    at Object.t.dispatch (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:1395)
    at n.notifyApplicationAfterPageLoad (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:2968)
    at n.pageLoaded (application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:2898)
    at application-f24d352b1e157b6f4410a50c85ed2f5d11350e2a262b43c3cc216e4ea778f982.js:formatted:2743

请注意,使用bundle exec foreman startheroku local在本地运行rails应用程序时,相同的代码可以很好地运行,因此必须使用特定的Heroku设置来破坏它吗?

我希望Hyperstack组件像在本地开发环境中一样加载。

0 个答案:

没有答案