Skip to content

Commit ae3fa51

Browse files
backstroke-botdmatchley
authored andcommitted
Update from upstream repo facebookincubator/create-react-app@master (#3)
* `react-error-overlay` has no dependencies now (facebook#3263) * `react-error-overlay` has no dependencies now (it's bundled) * Use babel 6 for now * Add external links to deployment services (facebook#3265) * Add warning when using `react-error-overlay` in production (facebook#3264) * Add a warning when running minified * Add more robust check * Update index.js * Use production React version for bundled overlay (facebook#3267) * Use production React version * We cannot strip our own checks if production * Keep the sourcemap during minify * Prevent devtools pollution * Add some comments * sigh
1 parent dd46ecb commit ae3fa51

File tree

5 files changed

+53
-27
lines changed

5 files changed

+53
-27
lines changed

packages/react-error-overlay/package.json

+12-14
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,16 @@
2727
],
2828
"author": "Joe Haddad <[email protected]>",
2929
"files": [
30-
"lib/",
31-
"middleware.js"
30+
"lib/index.js"
3231
],
33-
"dependencies": {
32+
"devDependencies": {
3433
"anser": "1.4.1",
3534
"babel-code-frame": "6.22.0",
36-
"babel-runtime": "6.26.0",
37-
"html-entities": "1.2.1",
38-
"object-assign": "4.1.1",
39-
"promise": "8.0.1",
40-
"react": "^15 || ^16",
41-
"react-dom": "^15 || ^16",
42-
"settle-promise": "1.0.0",
43-
"source-map": "0.5.6"
44-
},
45-
"devDependencies": {
35+
"babel-core": "^6.26.0",
4636
"babel-eslint": "7.2.3",
47-
"babel-preset-react-app": "^3.0.3",
4837
"babel-loader": "^7.1.2",
38+
"babel-preset-react-app": "^3.0.3",
39+
"babel-runtime": "6.26.0",
4940
"chalk": "^2.1.0",
5041
"chokidar": "^1.7.0",
5142
"cross-env": "5.0.5",
@@ -56,10 +47,17 @@
5647
"eslint-plugin-jsx-a11y": "5.1.1",
5748
"eslint-plugin-react": "7.1.0",
5849
"flow-bin": "^0.54.0",
50+
"html-entities": "1.2.1",
5951
"jest": "20.0.4",
6052
"jest-fetch-mock": "1.2.1",
53+
"object-assign": "4.1.1",
54+
"promise": "8.0.1",
6155
"raw-loader": "^0.5.1",
56+
"react": "^16.0.0",
57+
"react-dom": "^16.0.0",
6258
"rimraf": "^2.6.1",
59+
"settle-promise": "1.0.0",
60+
"source-map": "0.5.6",
6361
"webpack": "^3.6.0"
6462
},
6563
"jest": {

packages/react-error-overlay/src/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,10 @@ window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = function iframeReady()
167167
isLoadingIframe = false;
168168
updateIframeContent();
169169
};
170+
171+
if (process.env.NODE_ENV === 'production') {
172+
console.warn(
173+
'react-error-overlay is not meant for use in production. You should ' +
174+
'ensure it is not included in your build to reduce bundle size.'
175+
);
176+
}

packages/react-error-overlay/webpack.config.iframe.js

+23-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
'use strict';
88

99
const path = require('path');
10+
const webpack = require('webpack');
1011

1112
module.exports = {
12-
devtool: 'cheap-module-source-map',
1313
entry: './src/iframeScript.js',
1414
output: {
1515
path: path.join(__dirname, './lib'),
@@ -24,4 +24,26 @@ module.exports = {
2424
},
2525
],
2626
},
27+
plugins: [
28+
new webpack.DefinePlugin({
29+
// We set process.env.NODE_ENV to 'production' so that React is built
30+
// in production mode.
31+
'process.env': { NODE_ENV: '"production"' },
32+
// This prevents our bundled React from accidentally hijacking devtools.
33+
__REACT_DEVTOOLS_GLOBAL_HOOK__:
34+
'__REACT_ERROR_OVERLAY_GLOBAL_HOOK_NOOP__',
35+
}),
36+
// This code is embedded as a string, so it would never be optimized
37+
// elsewhere.
38+
new webpack.optimize.UglifyJsPlugin({
39+
compress: {
40+
warnings: false,
41+
comparisons: false,
42+
},
43+
output: {
44+
comments: false,
45+
ascii_only: false,
46+
},
47+
}),
48+
],
2749
};

packages/react-error-overlay/webpack.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
const path = require('path');
1010

1111
module.exports = {
12-
devtool: 'cheap-module-source-map',
1312
entry: './src/index.js',
1413
output: {
1514
path: path.join(__dirname, './lib'),

packages/react-scripts/template/README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1816,11 +1816,11 @@ If you are not using the HTML5 `pushState` history API or not using client-side
18161816
18171817
This will make sure that all the asset paths are relative to `index.html`. You will then be able to move your app from `http://mywebsite.com` to `http://mywebsite.com/relativepath` or even `http://mywebsite.com/relative/path` without having to rebuild it.
18181818

1819-
### Azure
1819+
### [Azure](https://azure.microsoft.com/)
18201820

1821-
See [this](https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321) blog post on how to deploy your React app to [Microsoft Azure](https://azure.microsoft.com/).
1821+
See [this](https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321) blog post on how to deploy your React app to Microsoft Azure.
18221822

1823-
### Firebase
1823+
### [Firebase](https://firebase.google.com/)
18241824

18251825
Install the Firebase CLI if you haven’t already by running `npm install -g firebase-tools`. Sign up for a [Firebase account](https://console.firebase.google.com/) and create a new project. Run `firebase login` and login with your previous created Firebase account.
18261826

@@ -1881,7 +1881,7 @@ Now, after you create a production build with `npm run build`, you can deploy it
18811881

18821882
For more information see [Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).
18831883

1884-
### GitHub Pages
1884+
### [GitHub Pages](https://pages.github.com/)
18851885

18861886
>Note: this feature is available with `[email protected]` and higher.
18871887

@@ -1951,7 +1951,7 @@ GitHub Pages doesn’t support routers that use the HTML5 `pushState` history AP
19511951
* 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://reacttraining.com/react-router/web/api/Router) about different history implementations in React Router.
19521952
* 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).
19531953

1954-
### Heroku
1954+
### [Heroku](https://www.heroku.com/)
19551955

19561956
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).<br>
19571957
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
@@ -1989,7 +1989,7 @@ remote: npm ERR! argv "/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/
19891989

19901990
In this case, ensure that the file is there with the proper lettercase and that’s not ignored on your local `.gitignore` or `~/.gitignore_global`.
19911991

1992-
### Netlify
1992+
### [Netlify](https://www.netlify.com/)
19931993

19941994
**To do a manual deploy to Netlify’s CDN:**
19951995

@@ -2018,9 +2018,9 @@ To support `pushState`, make sure to create a `public/_redirects` file with the
20182018

20192019
When you build the project, Create React App will place the `public` folder contents into the build output.
20202020

2021-
### Now
2021+
### [Now](https://zeit.co/now)
20222022

2023-
[now](https://zeit.co/now) offers a zero-configuration single-command deployment. You can use `now` to deploy your app for free.
2023+
Now offers a zero-configuration single-command deployment. You can use `now` to deploy your app for free.
20242024

20252025
1. Install the `now` command-line tool either via the recommended [desktop tool](https://zeit.co/download) or via node with `npm install -g now`.
20262026

@@ -2038,11 +2038,11 @@ When you build the project, Create React App will place the `public` folder cont
20382038

20392039
Details are available in [this article.](https://zeit.co/blog/unlimited-static)
20402040

2041-
### S3 and CloudFront
2041+
### [S3](https://aws.amazon.com/s3) and [CloudFront](https://aws.amazon.com/cloudfront/)
20422042

2043-
See this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services [S3](https://aws.amazon.com/s3) and [CloudFront](https://aws.amazon.com/cloudfront/).
2043+
See this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services S3 and CloudFront.
20442044

2045-
### Surge
2045+
### [Surge](https://surge.sh/)
20462046

20472047
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.
20482048

0 commit comments

Comments
 (0)