Don't strip error messages from builds (#9778)

This commit is contained in:
Dan Abramov
2017-05-25 18:56:18 +01:00
committed by GitHub
parent 492f7a8200
commit 7494e0485d
3 changed files with 23 additions and 31 deletions

View File

@@ -109,28 +109,21 @@ function getFooter(bundleType) {
}
function updateBabelConfig(babelOpts, bundleType) {
let newOpts;
switch (bundleType) {
case UMD_DEV:
case UMD_PROD:
case NODE_DEV:
case NODE_PROD:
case RN_DEV:
case RN_PROD:
newOpts = Object.assign({}, babelOpts);
// we add the objectAssign transform for these bundles
newOpts.plugins = newOpts.plugins.slice();
newOpts.plugins.push(
resolve('./scripts/babel/transform-object-assign-require')
);
return newOpts;
case FB_DEV:
case FB_PROD:
newOpts = Object.assign({}, babelOpts);
// for FB, we don't want the devExpressionWithCodes plugin to run
newOpts.plugins = [];
return newOpts;
return Object.assign({}, babelOpts, {
plugins: babelOpts.plugins.concat([
// Use object-assign polyfill in open source
resolve('./scripts/babel/transform-object-assign-require'),
// Replace __DEV__ with process.env.NODE_ENV and minify invariant messages
require('../error-codes/dev-expression-with-codes'),
])
});
default:
return babelOpts;
}
}

View File

@@ -1,7 +1,5 @@
'use strict';
const devExpressionWithCodes = require('../error-codes/dev-expression-with-codes');
const bundleTypes = {
UMD_DEV: 'UMD_DEV',
UMD_PROD: 'UMD_PROD',
@@ -24,14 +22,15 @@ const RN_PROD = bundleTypes.RN_PROD;
const babelOptsReact = {
exclude: 'node_modules/**',
plugins: [
devExpressionWithCodes, // this pass has to run before `rewrite-modules`
],
presets: [],
plugins: [],
};
const babelOptsReactART = Object.assign({}, babelOptsReact, {
// Include JSX
presets: [require.resolve('babel-preset-react')],
presets: babelOptsReact.presets.concat([
require.resolve('babel-preset-react'),
]),
});
const bundles = [

View File

@@ -165,20 +165,20 @@
"gzip": 83320
},
"ReactNativeStack-dev.js (RN_DEV)": {
"size": 183071,
"gzip": 35604
"size": 182999,
"gzip": 35650
},
"ReactNativeStack-prod.js (RN_PROD)": {
"size": 131236,
"gzip": 24775
"size": 134766,
"gzip": 25923
},
"ReactNativeFiber-dev.js (RN_DEV)": {
"size": 271213,
"gzip": 49113
"size": 271047,
"gzip": 49114
},
"ReactNativeFiber-prod.js (RN_PROD)": {
"size": 207321,
"gzip": 35756
"size": 208977,
"gzip": 36295
}
}
}