From 9a4f1d03db74c37d979ac8cb96c134ef50cdc099 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 2 Aug 2016 13:46:42 +0100 Subject: [PATCH 1/2] Make Babel config more verbose and simpler --- config/babel.dev.js | 17 ++++++++--------- config/babel.prod.js | 19 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/config/babel.dev.js b/config/babel.dev.js index 64545127d07..2fab1f08cdf 100644 --- a/config/babel.dev.js +++ b/config/babel.dev.js @@ -11,19 +11,18 @@ module.exports = { babelrc: false, cacheDirectory: true, presets: [ - 'babel-preset-es2015', - 'babel-preset-es2016', - 'babel-preset-react' - ].map(require.resolve), + require.resolve('babel-preset-es2015'), + require.resolve('babel-preset-es2016'), + require.resolve('babel-preset-react') + ], plugins: [ - 'babel-plugin-syntax-trailing-function-commas', - 'babel-plugin-transform-class-properties', - 'babel-plugin-transform-object-rest-spread' - ].map(require.resolve).concat([ + require.resolve('babel-plugin-syntax-trailing-function-commas'), + require.resolve('babel-plugin-transform-class-properties'), + require.resolve('babel-plugin-transform-object-rest-spread'), [require.resolve('babel-plugin-transform-runtime'), { helpers: false, polyfill: false, regenerator: true }] - ]) + ] }; diff --git a/config/babel.prod.js b/config/babel.prod.js index f5446012c5e..2e3af6e6b7b 100644 --- a/config/babel.prod.js +++ b/config/babel.prod.js @@ -10,20 +10,19 @@ module.exports = { babelrc: false, presets: [ - 'babel-preset-es2015', - 'babel-preset-es2016', - 'babel-preset-react' - ].map(require.resolve), + require.resolve('babel-preset-es2015'), + require.resolve('babel-preset-es2016'), + require.resolve('babel-preset-react') + ], plugins: [ - 'babel-plugin-syntax-trailing-function-commas', - 'babel-plugin-transform-class-properties', - 'babel-plugin-transform-object-rest-spread', - 'babel-plugin-transform-react-constant-elements', - ].map(require.resolve).concat([ + require.resolve('babel-plugin-syntax-trailing-function-commas'), + require.resolve('babel-plugin-transform-class-properties'), + require.resolve('babel-plugin-transform-object-rest-spread'), + require.resolve('babel-plugin-transform-react-constant-elements'), [require.resolve('babel-plugin-transform-runtime'), { helpers: false, polyfill: false, regenerator: true }] - ]) + ] }; From 02c3ed1ec986ea515bb804f7cad5c3313caa0fa2 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 2 Aug 2016 14:26:51 +0100 Subject: [PATCH 2/2] Support async/await --- config/babel.dev.js | 1 + config/babel.prod.js | 1 + package.json | 1 + 3 files changed, 3 insertions(+) diff --git a/config/babel.dev.js b/config/babel.dev.js index 2fab1f08cdf..291698b886e 100644 --- a/config/babel.dev.js +++ b/config/babel.dev.js @@ -17,6 +17,7 @@ module.exports = { ], plugins: [ require.resolve('babel-plugin-syntax-trailing-function-commas'), + require.resolve('babel-plugin-transform-async-to-generator'), require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-object-rest-spread'), [require.resolve('babel-plugin-transform-runtime'), { diff --git a/config/babel.prod.js b/config/babel.prod.js index 2e3af6e6b7b..7e112c4b55d 100644 --- a/config/babel.prod.js +++ b/config/babel.prod.js @@ -16,6 +16,7 @@ module.exports = { ], plugins: [ require.resolve('babel-plugin-syntax-trailing-function-commas'), + require.resolve('babel-plugin-transform-async-to-generator'), require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-object-rest-spread'), require.resolve('babel-plugin-transform-react-constant-elements'), diff --git a/package.json b/package.json index d29de30fe0d..4f49a5c89c2 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "babel-jest": "14.1.0", "babel-loader": "6.2.4", "babel-plugin-syntax-trailing-function-commas": "6.8.0", + "babel-plugin-transform-async-to-generator": "6.8.0", "babel-plugin-transform-class-properties": "6.11.5", "babel-plugin-transform-object-rest-spread": "6.8.0", "babel-plugin-transform-react-constant-elements": "6.9.1",