Skip to content

Commit 0ddc043

Browse files
EdwaRengaearon
authored andcommitted
Updated react-scripts Readme.md to better document GitHub Pages hosting with custom domains (facebook#3821)
1 parent 7969b48 commit 0ddc043

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

packages/react-scripts/template/README.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ In the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and s
301301
302302
Start your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm.
303303

304-
The same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.
304+
The same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.
305305

306306
## Formatting Code Automatically
307307

@@ -1676,7 +1676,7 @@ Use the following [`launch.json`](https://code.visualstudio.com/docs/editor/debu
16761676
"name": "Debug CRA Tests",
16771677
"type": "node",
16781678
"request": "launch",
1679-
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
1679+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
16801680
"args": [
16811681
"test",
16821682
"--runInBand",
@@ -1996,7 +1996,7 @@ If you’re using [Apache HTTP Server](https://httpd.apache.org/), you need to c
19961996
RewriteRule ^ index.html [QSA,L]
19971997
```
19981998
1999-
It will get copied to the `build` folder when you run `npm run build`.
1999+
It will get copied to the `build` folder when you run `npm run build`.
20002000
20012001
If you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow [this Stack Overflow answer](https://stackoverflow.com/a/41249464/4878474).
20022002
@@ -2156,6 +2156,11 @@ or for a GitHub user page:
21562156
"homepage": "https://myusername.github.io",
21572157
```
21582158

2159+
or for a custom domain page:
2160+
```json
2161+
"homepage": "https://mywebsite.com",
2162+
```
2163+
21592164
Create React App uses the `homepage` field to determine the root URL in the built HTML file.
21602165

21612166
#### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`
@@ -2216,6 +2221,12 @@ Finally, make sure **GitHub Pages** option in your GitHub project settings is se
22162221

22172222
You can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.
22182223

2224+
Your CNAME file should look like this:
2225+
2226+
```
2227+
mywebsite.com
2228+
```
2229+
22192230
#### Notes on client-side routing
22202231

22212232
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:
@@ -2432,7 +2443,7 @@ To resolve this:
24322443
1. Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
24332444
* Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the `module` field in `package.json`. Note that **even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers**.
24342445

2435-
2. Fork the package and publish a corrected version yourself.
2446+
2. Fork the package and publish a corrected version yourself.
24362447

24372448
3. If the dependency is small enough, copy it to your `src/` folder and treat it as application code.
24382449

0 commit comments

Comments
 (0)