react-deploy:
create-react-app react-deploy
cd react-deploy
npm start
installs gh-pages:
npm install gh-pages --save
Thêm vào package.json:
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
"homepage": "http://id1945.github.io/react-deploy",
package.json
ReactJS 2018
{
"name": "react-deploy",
"version": "0.1.0",
"private": true,
"homepage": "http://id1945.github.io/react-deploy",
"dependencies": {
"gh-pages": "^1.2.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
}
Tạo repository trên github here là: react-deploy
Sau đó add remote:
git init
git remote add origin https://github.com/id1945/react-deploy.git
Commit code:
git add *
git commit -m "first commit"
git push origin master
Run deploy:
npm run deploy
Nếu deploy vẫn không thấy như trên thì kiểm tra lại
0 nhận xét:
Post a Comment