Don't strip error messages from builds (#9778)
Dan Abramov committed
May 25, 2017 at 18:56 UTC
7494e0485df0fd37ebd52b34f41c55737270ba54
3 files changed
+23
-31
scripts/rollup/build.js
+10
-17
@@ -109,28 +109,21 @@ function getFooter(bundleType) {
109
}
110
111
function updateBabelConfig(babelOpts, bundleType) {
112
- let newOpts;
113
-
112
switch (bundleType) {
113
case UMD_DEV:
114
case UMD_PROD:
115
case NODE_DEV:
116
case NODE_PROD:
119
- case RN_DEV:
120
- case RN_PROD:
121
- newOpts = Object.assign({}, babelOpts);
122
- // we add the objectAssign transform for these bundles
123
- newOpts.plugins = newOpts.plugins.slice();
124
- newOpts.plugins.push(
125
- resolve('./scripts/babel/transform-object-assign-require')
126
- );
127
- return newOpts;
128
- case FB_DEV:
129
- case FB_PROD:
130
- newOpts = Object.assign({}, babelOpts);
131
- // for FB, we don't want the devExpressionWithCodes plugin to run
132
- newOpts.plugins = [];
133
- return newOpts;
117
+ return Object.assign({}, babelOpts, {
118
+ plugins: babelOpts.plugins.concat([
119
+ // Use object-assign polyfill in open source
120
+ resolve('./scripts/babel/transform-object-assign-require'),
121
+ // Replace __DEV__ with process.env.NODE_ENV and minify invariant messages
122
+ require('../error-codes/dev-expression-with-codes'),
123
+ ])
124
+ });
125
+ default:
126
+ return babelOpts;
127
}
128
}
129
scripts/rollup/bundles.js
+5
-6
@@ -1,7 +1,5 @@
1
'use strict';
2
3
-const devExpressionWithCodes = require('../error-codes/dev-expression-with-codes');
4
-
3
const bundleTypes = {
4
UMD_DEV: 'UMD_DEV',
5
UMD_PROD: 'UMD_PROD',
@@ -24,14 +22,15 @@ const RN_PROD = bundleTypes.RN_PROD;
22
23
const babelOptsReact = {
24
exclude: 'node_modules/**',
27
- plugins: [
28
- devExpressionWithCodes, // this pass has to run before `rewrite-modules`
29
- ],
25
+ presets: [],
26
+ plugins: [],
27
};
28
29
const babelOptsReactART = Object.assign({}, babelOptsReact, {
30
// Include JSX
34
- presets: [require.resolve('babel-preset-react')],
31
+ presets: babelOptsReact.presets.concat([
32
+ require.resolve('babel-preset-react'),
33
+ ]),
34
});
35
36
const bundles = [
scripts/rollup/results.json
+8
-8
@@ -165,20 +165,20 @@
165
"gzip": 83320
166
},
167
"ReactNativeStack-dev.js (RN_DEV)": {
168
- "size": 183071,
169
- "gzip": 35604
168
+ "size": 182999,
169
+ "gzip": 35650
170
},
171
"ReactNativeStack-prod.js (RN_PROD)": {
172
- "size": 131236,
173
- "gzip": 24775
172
+ "size": 134766,
173
+ "gzip": 25923
174
},
175
"ReactNativeFiber-dev.js (RN_DEV)": {
176
- "size": 271213,
177
- "gzip": 49113
176
+ "size": 271047,
177
+ "gzip": 49114
178
},
179
"ReactNativeFiber-prod.js (RN_PROD)": {
180
- "size": 207321,
181
- "gzip": 35756
180
+ "size": 208977,
181
+ "gzip": 36295
182
}
183
}
184
}
\ No newline at end of file