Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
770fdf4b
Commit
770fdf4b
authored
7 years ago
by
Aaron Lamb
Committed by
Joe Haddad
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Update User Guide with deploying to GitHub User pages (#3510)
parent
733ba3ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/react-scripts/template/README.md
+20
-2
packages/react-scripts/template/README.md
with
20 additions
and
2 deletions
+20
-2
packages/react-scripts/template/README.md
+
20
-
2
View file @
770fdf4b
...
...
@@ -2012,12 +2012,18 @@ For more information see [Add Firebase to your JavaScript Project](https://fireb
**The step below is important!**
<br>
**If you skip it, your app will not deploy correctly.**
Open your
`package.json`
and add a
`homepage`
field:
Open your
`package.json`
and add a
`homepage`
field
for your project
:
```
js
```
js
on
"homepage"
:
"https://myusername.github.io/my-app"
,
```
or for a GitHub user page:
```
json
"homepage"
:
"https://myusername.github.io"
,
```
Create React App uses the
`homepage`
field to determine the root URL in the built HTML file.
#### 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`:
The
`predeploy`
script will run automatically before
`deploy`
is run.
If you are deploying to a GitHub user page instead of a project page you'll need to make two
additional modifications:
1.
First, change your repository's source branch to be any branch other than
**master**
.
1.
Additionally, tweak your
`package.json`
scripts to push deployments to
**master**
:
```
diff
"scripts": {
"predeploy": "npm run build",
- "deploy": "gh-pages -d build",
+ "deploy": "gh-pages -b master -d build",
```
#### Step 3: Deploy the site by running `npm run deploy`
Then run:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets