简体   繁体   English

将React Webpack应用程序(不是使用create-react-app创建)部署到Github页面

[英]Deploying a React Webpack app (not created with create-react-app) to Github pages

I'm fairly new to the React ecosystem; 我是React生态系统的新手; I've made a simple single page webpage for a tech conference and I want to deploy it to gh-pages. 我为一个技术会议制作了一个简单的单页网页,我想将它部署到gh-pages。

I know create-react-app has very good documentation on deploying to gh-pages but my app was not made with that. 我知道create-react-app在部署到gh-pages方面有非常好的文档 ,但是我的应用程序不是用它来制作的。 I manually setup all the configurations for Webpack and React, instead of using the react-scripts module that create-react-app uses. 我手动设置Webpack和React的所有配置,而不是使用create-react-app使用的react-scripts模块。

I tried finding some posts about deploying a non-create-react-app to gh-pages but I've had no luck so I was wondering if there's any simple solutions. 我试着找一些关于将非创建反应应用程序部署到gh-pages的帖子,但我没有运气,所以我想知道是否有任何简单的解决方案。

My current solution is to just push only the dist folder to the gh-pages and serve that. 我目前的解决方案是只将dist文件夹推送到gh页面并提供服务。 I wanted to see if there's a simpler way where I can just push the whole dev branch over to gh-pages and be able to serve the correct elements still. 我想看看是否有一种更简单的方法,我可以将整个dev分支推送到gh-pages并且能够仍然提供正确的元素。

You can push the whole dev branch and select github to display the page from master branch. 您可以推送整个dev分支并选择github以显示来自master分支的页面。 Make sure that in master branch the scripts are compiled into / (index) of the repository, so your page shows up. 确保在master分支中将脚本编译到存储库的/ (索引)中,以便显示您的页面。

我知道这个问题已经晚了,但你可以使用gulpgulp-gh-pages自动将React构建推送到Github Pages。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM