将React Webpack应用程序(不是使用create-react-app创建的)部署到Github页面 [英] Deploying a React Webpack app (not created with create-react-app) to Github pages

查看:149
本文介绍了将React Webpack应用程序(不是使用create-react-app创建的)部署到Github页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对React生态系统相当陌生,我为技术会议制作了一个简单的单页网页,我想将其部署到gh页面。 我知道create-react-app有关于部署到gh页面的非常好的文档,但我的应用程序不是用这个做的。我手动设置了Webpack和React的所有配置,而不是使用react-scripts模块创建react-app的用法。

非创建反应的应用程序,但我没有运气,所以我想知道是否有任何简单的解决方案。



我目前的解决方案是只是推只有dist文件夹到gh页面并提供该服务。我想看看是否有一种更简单的方法,我可以将整个开发分支推送到gh页面,并且仍然能够提供正确的元素。

解决方案

您可以推送整个开发分支并选择github以显示 master 分支中的页面。确保在 master 分支中脚本被编译到版本库的 / (索引)中,这样你的页面就会显示出来。


I'm fairly new to the React ecosystem; I've made a simple single page webpage for a tech conference and I want to deploy it to gh-pages.

I know create-react-app has very good documentation on deploying to gh-pages but my app was not made with that. I manually setup all the configurations for Webpack and React, instead of using the react-scripts module that create-react-app uses.

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.

My current solution is to just push only the dist folder to the gh-pages and serve that. 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.

解决方案

You can push the whole dev branch and select github to display the page from master branch. Make sure that in master branch the scripts are compiled into / (index) of the repository, so your page shows up.

这篇关于将React Webpack应用程序(不是使用create-react-app创建的)部署到Github页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆