File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,10 +56,22 @@ jobs:
5656 - name : Build site
5757 run : pnpm build:site
5858
59- - name : Create .nojekyll for GitHub Pages
59+ - name : Setup GitHub Pages for SPA routing
6060 run : |
61+ # 创建 .nojekyll 文件,禁用 Jekyll 处理
6162 touch packages/cosmic-web/dist/.nojekyll
62- echo "/* /index.html 200" > packages/cosmic-web/dist/_redirects
63+ # 复制 index.html 为 404.html,用于处理 SPA 路由
64+ # 当访问不存在的路径时,GitHub Pages 会返回 404.html
65+ # 然后由前端路由处理实际路径
66+ if [ -f packages/cosmic-web/dist/index.html ]; then
67+ cp packages/cosmic-web/dist/index.html packages/cosmic-web/dist/404.html
68+ echo "✅ Created 404.html for SPA routing support"
69+ echo "📄 Files created:"
70+ ls -lh packages/cosmic-web/dist/*.html
71+ else
72+ echo "❌ Error: index.html not found!"
73+ exit 1
74+ fi
6375
6476 - name : Upload artifact
6577 uses : actions/upload-pages-artifact@v3
You can’t perform that action at this time.
0 commit comments