From fa38991b757edda8db5bf1aa351bb04d55574973 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 2 Aug 2016 14:38:43 +0100 Subject: [PATCH] Support async/await (#327) * Make Babel config more verbose and simpler * Support async/await --- config/babel.dev.js | 18 +++++++++--------- config/babel.prod.js | 20 ++++++++++---------- package.json | 1 + 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/config/babel.dev.js b/config/babel.dev.js index 64545127d07..291698b886e 100644 --- a/config/babel.dev.js +++ b/config/babel.dev.js @@ -11,19 +11,19 @@ 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-async-to-generator'), + 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..7e112c4b55d 100644 --- a/config/babel.prod.js +++ b/config/babel.prod.js @@ -10,20 +10,20 @@ 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-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'), [require.resolve('babel-plugin-transform-runtime'), { helpers: false, polyfill: false, regenerator: true }] - ]) + ] }; 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",