Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Hyperstack doesn't work in production

未關閉
#416 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
javascript, rails, react

研究方向

從 hyper-component-1.0.alpha1.8/lib/hyper-component.rb:7 開始,使用 bundle exec rake assets:precompile 重現 production asset 流程,然後開啟 localhost:3000。檢查 sprockets-rails 如何解析 react_ujs/package.json,並確認 production 頁面載入時沒有回報的 require is not defined 錯誤。

由索引模型根據 Issue 內容生成。

描述

Reproduction steps:

  • create a new hyperstack project

  • compile assets with bundle exec rake assets:precompile

  • start server in production environnment

  • Open your browser on localhost:3000

Expected result

Page should load without javascript errors

Actual result:

The page is blank with the following error:

Uncaught ReferenceError: require is not defined

Solution

I think this is due to the following line:

hyper-component-1.0.alpha1.8/lib/hyper-component.rb:7

Hyperstack.js_import 'react_ujs', defines: 'ReactRailsUJS'

sprockets-rails opens node_modules/react_ujs/package.json in order to determine the file to insert in application.js.
Unfortunally "main" is equal to react_ujs/index.js and this file contains "var React=require("react")"
I don't understand why "main" is not equal to react_ujs/dist/react_ujs.js.

My solution is to replace hyper-component-1.0.alpha1.8/lib/hyper-component.rb:7 by:

Hyperstack.js_import 'react_ujs/react_ujs/dist/react_ujs.js', defines: 'ReactRailsUJS'

主要語言
JavaScript
星號
538
分支
41
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

hyperstack-org/hyperstack 的其他 Issue

查看 hyperstack-org/hyperstack 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。