Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个应用程序,我正在使用npm gh-pages包部署到 gh-pages
npm gh-pages
我执行此命令"deploy": "npm run build && gh-pages -d build"它通常会创建构建文件夹。 但是当我转到 gh-pages 时,它只呈现一个静态组件。你可以在这里看到
"deploy": "npm run build && gh-pages -d build"
在网络中,我可以看到资源正在加载,js 文件,css 文件。我不确定问题是什么。可能是因为我使用的是反应路由器吗?
所有的帮助将不胜感激。
完整代码可以在这里找到链接
问题是您将 React 应用程序托管在子目录中,这意味着您的路由“/”在这里不再有效。
在 package.json 文件中添加 homepage 属性。
"homepage": "https://kiraburova.github.io/Marvel-ReactJS-API/",