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

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

问题描述

我对 React 生态系统还很陌生;我为技术会议制作了一个简单的单页网页,我想将它部署到 gh-pages.

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.

我知道 create-react-app 有关于部署到 gh 的非常好的文档-pages 但我的应用程序不是用它制作的.我手动设置了 Webpack 和 React 的所有配置,而不是使用 create-react-app 使用的 react-scripts 模块.

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.

我试图找到一些关于将非 create-react-app 部署到 gh-pages 的帖子,但我没有运气,所以我想知道是否有任何简单的解决方案.

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.

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

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.

推荐答案

可以push整个dev分支,选择github显示master分支的页面.确保在 master 分支中,脚本被编译到存储库的 /(索引)中,以便您的页面显示出来.

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天全站免登陆