diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index cb0a3193fe..9e36bf7e88 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -27,8 +27,7 @@ ], "author": "Joe Haddad ", "files": [ - "lib/", - "middleware.js" + "lib/index.js" ], "devDependencies": { "anser": "1.4.1", diff --git a/packages/react-error-overlay/webpack.config.iframe.js b/packages/react-error-overlay/webpack.config.iframe.js index 9fa742b720..031762e593 100644 --- a/packages/react-error-overlay/webpack.config.iframe.js +++ b/packages/react-error-overlay/webpack.config.iframe.js @@ -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'), @@ -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, + }, + }), + ], }; diff --git a/packages/react-error-overlay/webpack.config.js b/packages/react-error-overlay/webpack.config.js index 5d640e05ca..bc8b363f76 100644 --- a/packages/react-error-overlay/webpack.config.js +++ b/packages/react-error-overlay/webpack.config.js @@ -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'),