-[Building for Relative Paths](#building-for-relative-paths)
-[Modulus](#modulus)
-[GitHub Pages](#github-pages)
-[Heroku](#heroku)
-[Heroku](#heroku)
-[Modulus](#modulus)
-[Now](#now)
-[Surge](#surge)
-[Surge](#surge)
-[GitHub Pages](#github-pages)
-[Something Missing?](#something-missing)
-[Something Missing?](#something-missing)
## Updating to New Releases
## Updating to New Releases
...
@@ -80,6 +81,7 @@ my-app/
...
@@ -80,6 +81,7 @@ my-app/
src/
src/
App.css
App.css
App.js
App.js
App.test.js
index.css
index.css
index.js
index.js
logo.svg
logo.svg
...
@@ -743,6 +745,8 @@ This feature is experimental and still [has major usage issues](https://github.c
...
@@ -743,6 +745,8 @@ This feature is experimental and still [has major usage issues](https://github.c
## Deployment
## Deployment
## Building for Relative Paths
By default, Create React App produces a build assuming your app is hosted at the server root.
By default, Create React App produces a build assuming your app is hosted at the server root.
To override this, specify the `homepage` in your `package.json`, for example:
To override this, specify the `homepage` in your `package.json`, for example:
...
@@ -752,40 +756,6 @@ To override this, specify the `homepage` in your `package.json`, for example:
...
@@ -752,40 +756,6 @@ To override this, specify the `homepage` in your `package.json`, for example:
This will let Create React App correctly infer the root path to use in the generated HTML file.
This will let Create React App correctly infer the root path to use in the generated HTML file.
### Now
See [this example](https://github.com/xkawi/create-react-app-now) for a zero-configuration single-command deployment with [now](https://zeit.co/now).
### Modulus
See the [Modulus blog post](http://blog.modulus.io/deploying-react-apps-on-modulus) on how to deploy your react app to Modulus.
### Heroku
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
### Surge
Install the Surge CLI if you haven't already by running `npm install -g surge`. Run the `surge` command and log in you or create a new account. You just need to specify the *build* folder and your custom domain, and you are done.
```sh
email: email@domain.com
password: ********
project path: /path/to/project/build
size: 7 files, 1.8 MB
domain: create-react-app.surge.sh
upload: [====================] 100%, eta: 0.0s
propagate on CDN: [====================] 100%
plan: Free
users: email@domain.com
IP Address: X.X.X.X
Success! Project is published and running at create-react-app.surge.sh
```
Note that in order to support routers that use html5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing).
### GitHub Pages
### GitHub Pages
>Note: this feature is available with `react-scripts@0.2.0` and higher.
>Note: this feature is available with `react-scripts@0.2.0` and higher.
...
@@ -817,6 +787,40 @@ Note that GitHub Pages doesn't support routers that use the HTML5 `pushState` hi
...
@@ -817,6 +787,40 @@ Note that GitHub Pages doesn't support routers that use the HTML5 `pushState` hi
* You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#histories) about different history implementations in React Router.
* You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#histories) about different history implementations in React Router.
* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).
* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).
### Heroku
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
### Modulus
See the [Modulus blog post](http://blog.modulus.io/deploying-react-apps-on-modulus) on how to deploy your react app to Modulus.
### Now
See [this example](https://github.com/xkawi/create-react-app-now) for a zero-configuration single-command deployment with [now](https://zeit.co/now).
### Surge
Install the Surge CLI if you haven't already by running `npm install -g surge`. Run the `surge` command and log in you or create a new account. You just need to specify the *build* folder and your custom domain, and you are done.
```sh
email: email@domain.com
password: ********
project path: /path/to/project/build
size: 7 files, 1.8 MB
domain: create-react-app.surge.sh
upload: [====================] 100%, eta: 0.0s
propagate on CDN: [====================] 100%
plan: Free
users: email@domain.com
IP Address: X.X.X.X
Success! Project is published and running at create-react-app.surge.sh
```
Note that in order to support routers that use html5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing).
## Something Missing?
## Something Missing?
If you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/template/README.md)
If you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/template/README.md)