使用 create-react-app deploy 部署到 g
作者:
McDu | 来源:发表于
2018-04-09 19:38 被阅读261次
- 安装
gh-pages
:
npm install gh-pages --save-dev
-
package.json
添加 :
"homepage": "https://myusername.github.io", myusername 是你的 github 名
"scripts": {
+ "predeploy": "npm run build",
+ "deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
- 在本地项目中运行:
npm run deploy
- 在浏览器里访问
https://myusername.github.io/项目名
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages
本文标题:使用 create-react-app deploy 部署到 g
本文链接:https://www.haomeiwen.com/subject/ksfwhftx.html
网友评论