You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Uncomment merged PRs
* Switch to br
* Update some webpack links
* Add a little about section for PWA
* oops
* fast on subsequent visits
* Add manual proxy config instructions
* hint package.json
* Change to js for comments
* Tune wording
Copy file name to clipboardexpand all lines: README.md
+1-5
Original file line number
Diff line number
Diff line change
@@ -100,10 +100,8 @@ Builds the app for production to the `build` folder.<br>
100
100
It correctly bundles React in production mode and optimizes the build for the best performance.
101
101
102
102
The build is minified and the filenames include the hashes.<br>
103
-
Your app is ready to be deployed!
104
-
<!--TODO: uncoment and maybe revise
105
103
A [service worker](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers) using an [offline-first caching strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network) is automatically generated.<br>
106
-
Your ([progressive web](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app)) app is ready to be deployed!-->
104
+
Your ([progressive web](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app)) app is ready to be deployed
107
105
108
106
## User Guide
109
107
@@ -165,9 +163,7 @@ Please refer to the [User Guide](https://github.com/facebookincubator/create-rea
165
163
* Import CSS and image files directly from JavaScript.
166
164
* Autoprefixed CSS, so you don’t need `-webkit` or other prefixes.
167
165
* A `build` script to bundle JS, CSS, and images for production, with sourcemaps.
168
-
<!--TODO: uncomment
169
166
* An offline-first [service worker](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers) and a [web app manifest](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/), meeting all the [Progressive Web App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app) criteria.
170
-
-->
171
167
172
168
**The feature set is intentionally limited**. It doesn’t support advanced features such as server rendering or CSS modules. The tool is also **non-configurable** because it is hard to provide a cohesive experience and easy updates across a set of tools when the user can tweak anything.
-[Progressive Web App Metadata](#progressive-web-app-metadata)
67
-
-->
68
67
-[Deployment](#deployment)
69
68
-[Static Server](#static-server)
70
69
-[Other Solutions](#other-solutions)
@@ -212,7 +211,7 @@ To configure the syntax highlighting in your favorite text editor, head to the [
212
211
213
212
## Displaying Lint Output in the Editor
214
213
215
-
>Note: this feature is available with `react-scripts@0.2.0` and higher.
214
+
>Note: this feature is available with `react-scripts@0.2.0` and higher.<br>
216
215
>It also only works with npm 3 or higher.
217
216
218
217
Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.
@@ -331,7 +330,7 @@ Learn more about ES6 modules:
331
330
332
331
## Adding a Stylesheet
333
332
334
-
This project setup uses [Webpack](https://webpack.github.io/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:
333
+
This project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:
335
334
336
335
### `Button.css`
337
336
@@ -446,7 +445,7 @@ Then we can change `start` and `build` scripts to include the CSS preprocessor c
446
445
}
447
446
```
448
447
449
-
Now running `npm start` and `npm run build` also builds Sass files.
448
+
Now running `npm start` and `npm run build` also builds Sass files.
450
449
451
450
**Why `node-sass-chokidar`?**
452
451
@@ -744,24 +743,23 @@ To define permanent environment variables, create a file called `.env` in the ro
744
743
REACT_APP_SECRET_CODE=abcdef
745
744
```
746
745
747
-
<!--
748
-
TODO: uncomment (and tweak) the doc for 0.10
749
-
What .env* files are used?
746
+
`.env` files **should be** checked into source control (with the exclusion of `.env*.local`).
747
+
748
+
What other `.env` files are can be used?
749
+
750
+
>Note: this feature is available with `react-scripts@1.0.0` and higher.
These variables will act as the defaults if the machine does not explicitly set them.<br>
766
764
Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.
767
765
@@ -833,9 +831,68 @@ Keep in mind that `proxy` only has effect in development (with `npm start`), and
833
831
The `proxy` option supports HTTP, HTTPS and WebSocket connections.<br>
834
832
If the `proxy` option is **not** flexible enough for you, alternatively you can:
835
833
834
+
*[Configure the proxy yourself](#configuring-the-proxy-manually)
836
835
* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)).
837
836
* Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app.
838
837
838
+
### Configuring the Proxy Manually
839
+
840
+
>Note: this feature is available with `react-scripts@1.0.0` and higher.
841
+
842
+
If the `proxy` option is **not** flexible enough for you, you can specify an object in the following form (in `package.json`).<br>
843
+
You may also specify any configuration value [`http-proxy-middleware`](https://github.com/chimurai/http-proxy-middleware#options) or [`http-proxy`](https://github.com/nodejitsu/node-http-proxy#options) supports.
844
+
```js
845
+
{
846
+
// ...
847
+
"proxy": {
848
+
"/api": {
849
+
"target":"<url>",
850
+
"ws":true
851
+
// ...
852
+
}
853
+
}
854
+
// ...
855
+
}
856
+
```
857
+
858
+
All requests matching this path will be proxies, no exceptions. This includes requests for `text/html`, which the standard `proxy` option does not proxy.
859
+
860
+
If you need to specify multiple proxies, you may do so by specifying additional entries.
861
+
You may also narrow down matches using `*` and/or `**`, to match the path exactly or any subpath.
862
+
```js
863
+
{
864
+
// ...
865
+
"proxy": {
866
+
// Matches any request starting with /api
867
+
"/api": {
868
+
"target":"<url_1>",
869
+
"ws":true
870
+
// ...
871
+
},
872
+
// Matches any request starting with /foo
873
+
"/foo": {
874
+
"target":"<url_2>",
875
+
"ssl":true,
876
+
"pathRewrite": {
877
+
"^/foo":"/foo/beta"
878
+
}
879
+
// ...
880
+
},
881
+
// Matches /bar/abc.html but not /bar/sub/def.html
882
+
"/bar/*.html": {
883
+
"target":"<url_3>",
884
+
// ...
885
+
},
886
+
// Matches /bar/abc.html and /bar/sub/def.html
887
+
"/baz/**/*.html": {
888
+
"target":"<url_4>"
889
+
// ...
890
+
}
891
+
}
892
+
// ...
893
+
}
894
+
```
895
+
839
896
## Using HTTPS in Development
840
897
841
898
>Note: this feature is available with `react-scripts@0.4.0` and higher.
@@ -1218,15 +1275,17 @@ Learn more about React Storybook:
1218
1275
1219
1276
## Making a Progressive Web App
1220
1277
1221
-
You can turn your React app into a [Progressive Web App](https://developers.google.com/web/progressive-web-apps/) by following the steps in [this repository](https://github.com/jeffposnick/create-react-pwa).
1222
-
1223
-
<!--
1224
-
TODO: uncomment
1225
1278
By default, the production build is a fully functional, offline-first
1226
1279
[Progressive Web App](https://developers.google.com/web/progressive-web-apps/).
1227
1280
1281
+
Progressive Web Apps are faster and more reliable than traditional web pages, and provide an engaging mobile experience:
1282
+
1283
+
* All static site assets are cached so that your page loads fast on subsequent visits, regardless of network connectivity (such as 2G or 3G). Updates are downloaded in the background.
1284
+
* Your app will work regardless of network state, even if offline. This means your users will be able to use your app at 10,000 feet and on the Subway.
1285
+
* On mobile devices, your app can be added directly to the user's home screen, app icon and all. You can also re-engage users using web **push notifications**. This eliminates the need for the app store.
1286
+
1228
1287
The [`sw-precache-webpack-plugin`](https://github.com/goldhand/sw-precache-webpack-plugin)
1229
-
is integrated into [`webpack.config.prod.js`](../config/webpack.config.prod.js),
1288
+
is integrated into production configuration,
1230
1289
and it will take care of generating a service worker file that will automatically
1231
1290
precache all of your local assets and keep them up to date as you deploy updates.
1232
1291
The service worker will use a [cache-first strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network)
@@ -1265,9 +1324,8 @@ changes you've made locally.
1265
1324
1. If you *need* to test your offline-first service worker locally, build
1266
1325
the application (using `npm run build`) and run a simple http server from your
1267
1326
build directory. After running the build script, `create-react-app` will give
1268
-
instructions for one way to test your production build locally using
1269
-
`pushstate-server` and the [deployment instructions](#deployment) have
1270
-
instructions for using the python `SimpleHTTPServer`. *Be sure to always use an
1327
+
instructions for one way to test your production build locally and the [deployment instructions](#deployment) have
1328
+
instructions for using other methods. *Be sure to always use an
1271
1329
incognito window to avoid complications with your browser cache.*
1272
1330
1273
1331
1. If possible,configure your production environment to serve the generated
@@ -1315,8 +1373,6 @@ icons, names, and branding colors to use when the web app is displayed.
1315
1373
provides more context about what each field means, and how your customizations
1316
1374
will affect your users' experience.
1317
1375
1318
-
-->
1319
-
1320
1376
## Deployment
1321
1377
1322
1378
`npm run build` creates a `build` directory with a production build of your app. Set up your favourite HTTP server so that a visitor to your site is served `index.html`, and requests to static paths like `/static/js/main.<hash>.js` are served with the contents of the `/static/js/main.<hash>.js` file.
@@ -1392,9 +1448,6 @@ It will get copied to the `build` folder when you run `npm run build`.
1392
1448
1393
1449
Now requests to `/todos/42` will be handled correctly both in development and in production.
1394
1450
1395
-
<!--
1396
-
TODO: uncomment for 1.0
1397
-
1398
1451
On a production build, and in a browser that supports [service workers](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers),
1399
1452
the service worker will automatically handle all navigation requests, like for
1400
1453
`/todos/42`, by serving the cached copy of your `index.html`. This
@@ -1403,7 +1456,6 @@ service worker navigation routing can be configured or disabled by
and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp)
1405
1458
options of the `SWPreachePlugin`[configuration](../config/webpack.config.prod.js).
1406
-
-->
1407
1459
1408
1460
### Building for Relative Paths
1409
1461
@@ -1675,7 +1727,7 @@ You can adjust various development and production settings by setting environmen
1675
1727
1676
1728
Variable | Development | Production | Usage
1677
1729
:--- | :---: | :---: | :---
1678
-
BROWSER | :white_check_mark: | :x: | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/opn#app) to override this behavior, or set it to `none` to disable it completely. <!-- TODO: enable with 0.10: If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension. -->
1730
+
BROWSER | :white_check_mark: | :x: | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/opn#app) to override this behavior, or set it to `none` to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension.
1679
1731
HOST | :white_check_mark: | :x: | By default, the development web server binds to `localhost`. You may use this variable to specify a different host.
1680
1732
PORT | :white_check_mark: | :x: | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port.
1681
1733
HTTPS | :white_check_mark: | :x: | When set to `true`, Create React App will run the development server in`https` mode.
@@ -1691,7 +1743,7 @@ If this doesn’t happen, try one of the following workarounds:
1691
1743
1692
1744
* If your project is in a Dropbox folder, try moving it out.
1693
1745
* If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebookincubator/create-react-app/issues/1164) due to a Webpack bug.
1694
-
* Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Working with editors supporting safe write”](https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write).
1746
+
* Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Adjusting Your Text Editor”](https://webpack.js.org/guides/development/#adjusting-your-text-editor).
1695
1747
* If your project path contains parentheses, try moving the project to a path without them. This is caused by a [Webpack watcher bug](https://github.com/webpack/watchpack/issues/42).
1696
1748
* On Linux and macOS, you might need to [tweak system settings](https://webpack.github.io/docs/troubleshooting.html#not-enough-watchers) to allow more watchers.
1697
1749
* If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an `.env` file in your project directory if it doesn’t exist, and add `CHOKIDAR_USEPOLLING=true` to it. This ensures that the next time you run `npm start`, the watcher uses the polling mode, as necessary inside a VM.
0 commit comments