美文网首页
使用 create-react-app deploy 部署到 g

使用 create-react-app deploy 部署到 g

作者: McDu | 来源:发表于2018-04-09 19:38 被阅读261次
  1. 安装 gh-pages
npm install gh-pages --save-dev
  1. 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",
  1. 在本地项目中运行:
npm run deploy
  1. 在浏览器里访问
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