ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit 540db65aadce80b32fa05421e52923741fccb3c1
parent 314a7bb5172c284bfa345c1cd9262a4588923a1d
Author: Olivier Tassinari <olivier.tassinari@gmail.com>
Date:   Mon,  4 Apr 2016 22:04:50 +0200

[Babel] Improve the production build

Diffstat:
Mpackage.json | 3+++
Mtools/webpack.config.js | 17++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json @@ -46,6 +46,9 @@ "babel-jest": "^9.0.3", "babel-loader": "^6.2.4", "babel-plugin-react-transform": "^2.0.2", + "babel-plugin-transform-react-constant-elements": "^6.5.0", + "babel-plugin-transform-react-inline-elements": "^6.6.5", + "babel-plugin-transform-react-remove-prop-types": "^0.2.4", "babel-plugin-transform-runtime": "^6.6.0", "babel-preset-es2015": "^6.6.0", "babel-preset-node5": "^11.0.1", diff --git a/tools/webpack.config.js b/tools/webpack.config.js @@ -34,6 +34,19 @@ const GLOBALS = { // client-side (client.js) and server-side (server.js) bundles // ----------------------------------------------------------------------------- +let babelLoaderPlugins = [ + 'transform-runtime', +]; + +if (!DEBUG) { + babelLoaderPlugins = [ + ...babelLoaderPlugins, + 'transform-react-remove-prop-types', + 'transform-react-constant-elements', + 'transform-react-inline-elements', + ]; +} + const config = { context: path.resolve(__dirname, '../src'), @@ -63,9 +76,7 @@ const config = { 'es2015', 'stage-0', ], - plugins: [ - 'transform-runtime', - ], + plugins: babelLoaderPlugins, }, }, {