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

家住魔仙堡 提交于 2019-12-02 12:22:34

问题


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.


回答1:


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.




回答2:


I know it's late on this question, but you can use gulp with gulp-gh-pages to automate pushing a React build to Github Pages.



来源:https://stackoverflow.com/questions/42545439/deploying-a-react-webpack-app-not-created-with-create-react-app-to-github-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!