@@ -2012,12 +2012,18 @@ For more information see [Add Firebase to your JavaScript Project](https://fireb
2012
2012
** The step below is important! ** < br>
2013
2013
** If you skip it, your app will not deploy correctly.**
2014
2014
2015
- Open your ` package.json` and add a ` homepage` field:
2015
+ Open your ` package.json` and add a ` homepage` field for your project :
2016
2016
2017
- ` ` ` js
2017
+ ` ` ` json
2018
2018
"homepage": "https://myusername.github.io/my-app",
2019
2019
` ` `
2020
2020
2021
+ or for a GitHub user page:
2022
+
2023
+ ` ` ` json
2024
+ "homepage": "https://myusername.github.io",
2025
+ ` ` `
2026
+
2021
2027
Create React App uses the ` homepage` field to determine the root URL in the built HTML file.
2022
2028
2023
2029
#### Step 2 : Install ` gh-pages` and add ` deploy` to ` scripts` in ` package.json`
@@ -2048,6 +2054,18 @@ Add the following scripts in your `package.json`:
2048
2054
2049
2055
The ` predeploy` script will run automatically before ` deploy` is run.
2050
2056
2057
+ If you are deploying to a GitHub user page instead of a project page you' ll need to make two
2058
+ additional modifications:
2059
+
2060
+ 1. First, change your repository' s source branch to be any branch other than ** master** .
2061
+ 1. Additionally, tweak your ` package.json` scripts to push deployments to ** master** :
2062
+ ` ` ` diff
2063
+ "scripts": {
2064
+ "predeploy": "npm run build",
2065
+ - "deploy": "gh-pages -d build",
2066
+ + "deploy": "gh-pages -b master -d build",
2067
+ ` ` `
2068
+
2051
2069
#### Step 3 : Deploy the site by running ` npm run deploy`
2052
2070
2053
2071
Then run:
0 commit comments