Commit 991b092c authored by Joe Haddad's avatar Joe Haddad Committed by GitHub
Browse files

Use production React version for bundled overlay (#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
parent 9ce144ed
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 24 additions and 4 deletions
+24 -4
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
], ],
"author": "Joe Haddad <timer150@gmail.com>", "author": "Joe Haddad <timer150@gmail.com>",
"files": [ "files": [
"lib/", "lib/index.js"
"middleware.js"
], ],
"devDependencies": { "devDependencies": {
"anser": "1.4.1", "anser": "1.4.1",
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
'use strict'; 'use strict';
const path = require('path'); const path = require('path');
const webpack = require('webpack');
module.exports = { module.exports = {
devtool: 'cheap-module-source-map',
entry: './src/iframeScript.js', entry: './src/iframeScript.js',
output: { output: {
path: path.join(__dirname, './lib'), path: path.join(__dirname, './lib'),
...@@ -24,4 +24,26 @@ module.exports = { ...@@ -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,
},
}),
],
}; };
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
const path = require('path'); const path = require('path');
module.exports = { module.exports = {
devtool: 'cheap-module-source-map',
entry: './src/index.js', entry: './src/index.js',
output: { output: {
path: path.join(__dirname, './lib'), path: path.join(__dirname, './lib'),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment