Note:
This feature is available
with react-scripts@0.2.0 and higher.
Prerequisites:
- The project should be checked in to github.
- In project setting enable gh-pages
Step 1: Add homepage to
package.json.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
"homepage": "https://myusername.github.io/my-app", |
Step 2: Install gh-pages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save-dev gh-pages |
Step 3: Add the following scripts in
your package.json.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
"scripts": { | |
// ... | |
"predeploy": "npm run build", | |
"deploy": "gh-pages -d build" | |
} |
The pre-deploy script
will run automatically before deploy is run.
Step 3: Now deploy the application
by running the below command
I have deployed a sample app.
bulletin-board
Code in Github.com
I have deployed a sample app.
bulletin-board
Code in Github.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm run deploy |
0 comments:
Post a Comment