Hyperstack doesn't work in production
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript, rails, react
- 領域
- build-system, frontend
研究方向
從 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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
hyperstack-org/hyperstack 的其他 Issue
-
enhancement needs doc
難度 2/5 1-3 小時 新手友好度 68/100
hyperstack-org/hyperstack#359 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
hyperstack-org/hyperstack#267 ·
-
難度 5/5 一週以上 新手友好度 25/100
hyperstack-org/hyperstack#457 ·
-
難度 3/5 1-2 天 新手友好度 35/100
hyperstack-org/hyperstack#456 ·
-
難度 5/5 一週以上 新手友好度 15/100
hyperstack-org/hyperstack#455 · 2 則留言 ·
查看 hyperstack-org/hyperstack 的全部 Issue
相似的 Issue
-
難度 1/5 1-3 小時 新手友好度 78/100
Mintplex-Labs/anything-llm#6490 ·
-
難度 2/5 1-3 小時 新手友好度 86/100
-
[quality] workflow-scripts guard reads test:unit:coverage as skipping the unit suite, blocking #632 未關閉agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
難度 2/5 1-3 小時 新手友好度 86/100
-
難度 2/5 1-3 小時 新手友好度 72/100
-
area-clientside-dartpad
難度 2/5 1-3 小時 新手友好度 62/100