Skip to content

Commit 540db65

Browse files
[Babel] Improve the production build
1 parent 314a7bb commit 540db65

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"babel-jest": "^9.0.3",
4747
"babel-loader": "^6.2.4",
4848
"babel-plugin-react-transform": "^2.0.2",
49+
"babel-plugin-transform-react-constant-elements": "^6.5.0",
50+
"babel-plugin-transform-react-inline-elements": "^6.6.5",
51+
"babel-plugin-transform-react-remove-prop-types": "^0.2.4",
4952
"babel-plugin-transform-runtime": "^6.6.0",
5053
"babel-preset-es2015": "^6.6.0",
5154
"babel-preset-node5": "^11.0.1",

tools/webpack.config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ const GLOBALS = {
3434
// client-side (client.js) and server-side (server.js) bundles
3535
// -----------------------------------------------------------------------------
3636

37+
let babelLoaderPlugins = [
38+
'transform-runtime',
39+
];
40+
41+
if (!DEBUG) {
42+
babelLoaderPlugins = [
43+
...babelLoaderPlugins,
44+
'transform-react-remove-prop-types',
45+
'transform-react-constant-elements',
46+
'transform-react-inline-elements',
47+
];
48+
}
49+
3750
const config = {
3851
context: path.resolve(__dirname, '../src'),
3952

@@ -63,9 +76,7 @@ const config = {
6376
'es2015',
6477
'stage-0',
6578
],
66-
plugins: [
67-
'transform-runtime',
68-
],
79+
plugins: babelLoaderPlugins,
6980
},
7081
},
7182
{

0 commit comments

Comments
 (0)