Skip to content

Update from upstream repo facebookincubator/create-react-app@master #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/react-error-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
],
"author": "Joe Haddad <[email protected]>",
"files": [
"lib/",
"middleware.js"
"lib/index.js"
],
"devDependencies": {
"anser": "1.4.1",
Expand Down
7 changes: 7 additions & 0 deletions packages/react-error-overlay/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,10 @@ window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = function iframeReady()
isLoadingIframe = false;
updateIframeContent();
};

if (process.env.NODE_ENV === 'production') {
console.warn(
'react-error-overlay is not meant for use in production. You should ' +
'ensure it is not included in your build to reduce bundle size.'
);
}
24 changes: 23 additions & 1 deletion packages/react-error-overlay/webpack.config.iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
'use strict';

const path = require('path');
const webpack = require('webpack');

module.exports = {
devtool: 'cheap-module-source-map',
entry: './src/iframeScript.js',
output: {
path: path.join(__dirname, './lib'),
Expand All @@ -24,4 +24,26 @@ module.exports = {
},
],
},
plugins: [
new webpack.DefinePlugin({
// We set process.env.NODE_ENV to 'production' so that React is built
// in production mode.
'process.env': { NODE_ENV: '"production"' },
// This prevents our bundled React from accidentally hijacking devtools.
__REACT_DEVTOOLS_GLOBAL_HOOK__:
'__REACT_ERROR_OVERLAY_GLOBAL_HOOK_NOOP__',
}),
// This code is embedded as a string, so it would never be optimized
// elsewhere.
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
comparisons: false,
},
output: {
comments: false,
ascii_only: false,
},
}),
],
};
1 change: 0 additions & 1 deletion packages/react-error-overlay/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
const path = require('path');

module.exports = {
devtool: 'cheap-module-source-map',
entry: './src/index.js',
output: {
path: path.join(__dirname, './lib'),
Expand Down