Skip to content

Commit 97f708d

Browse files
gaearonjarlef
authored andcommitted
It's important after all
1 parent 1abb049 commit 97f708d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-scripts/template/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -878,15 +878,19 @@ This will let Create React App correctly infer the root path to use in the gener
878878
879879
>Note: this feature is available with `[email protected]` and higher.
880880
881+
**THE BELOW STEP IS IMPORTANT!**<br>
882+
**If your skip it, your app will not deploy correctly.**
883+
881884
Open your `package.json` and add a `homepage` field:
882885
883886
```js
884887
"homepage": "https://myusername.github.io/my-app",
885888
```
886889
887-
**The above step is important!**<br>
888890
Create React App uses the `homepage` field to determine the root URL in the built HTML file.
889891
892+
**Have you added the `homepage` field? Then let's move on.**
893+
890894
Now, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages.
891895
892896
To publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run:
@@ -913,6 +917,8 @@ Then run:
913917
npm run deploy
914918
```
915919
920+
**If you see 404 errors for JS and CSS, re-read the note at the beginning of this section saying "THE BELOW STEP IS IMPORTANT".**
921+
916922
You can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.
917923
918924
Note that GitHub Pages doesn't support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions:

0 commit comments

Comments
 (0)