问题
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