From cd184cde9f08b4c0226ed598e42192c9a44b2354 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Tue, 2 Aug 2016 21:55:00 +0300 Subject: [PATCH 1/3] Transform async functions with regenerator Remove `transform-async-to-generator`, which to my understanding is meant to be used in environments that support generators natively. Because we're compiling generators to ES5 anyway, we can simply use `regenerator` to transform async functions too, which results in slightly simpler output and only uses the regenerator runtime instead regenerator runtime + _asyncToGenerator Babel helper. --- config/babel.dev.js | 3 ++- config/babel.prod.js | 3 ++- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config/babel.dev.js b/config/babel.dev.js index 291698b886e..2c41ed9149a 100644 --- a/config/babel.dev.js +++ b/config/babel.dev.js @@ -17,9 +17,10 @@ module.exports = { ], plugins: [ require.resolve('babel-plugin-syntax-trailing-function-commas'), - require.resolve('babel-plugin-transform-async-to-generator'), + require.resolve('babel-plugin-syntax-async-functions'), require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-object-rest-spread'), + require.resolve('babel-plugin-transform-regenerator'), [require.resolve('babel-plugin-transform-runtime'), { helpers: false, polyfill: false, diff --git a/config/babel.prod.js b/config/babel.prod.js index 7e112c4b55d..754302a20d9 100644 --- a/config/babel.prod.js +++ b/config/babel.prod.js @@ -16,10 +16,11 @@ module.exports = { ], plugins: [ require.resolve('babel-plugin-syntax-trailing-function-commas'), - require.resolve('babel-plugin-transform-async-to-generator'), + require.resolve('babel-plugin-syntax-async-functions'), 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-regenerator'), [require.resolve('babel-plugin-transform-runtime'), { helpers: false, polyfill: false, diff --git a/package.json b/package.json index 4f49a5c89c2..b2d056a5cf2 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "babel-eslint": "6.1.2", "babel-jest": "14.1.0", "babel-loader": "6.2.4", + "babel-plugin-syntax-async-functions": "^6.8.0", "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", From f918b60df98910687d0dec5d470a7b10e94a8a02 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Tue, 2 Aug 2016 22:09:04 +0300 Subject: [PATCH 2/3] Add babel-plugin-transform-regenerator --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b2d056a5cf2..5cc4990fee2 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "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", + "babel-plugin-transform-regenerator": "^6.11.4", "babel-plugin-transform-runtime": "6.12.0", "babel-preset-es2015": "6.9.0", "babel-preset-es2016": "6.11.3", From 6927a324aed387eb596471ac04612d0d9386daa2 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Tue, 2 Aug 2016 23:11:52 +0300 Subject: [PATCH 3/3] Use dependencies with an exact version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5cc4990fee2..15eaec52374 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,12 @@ "babel-eslint": "6.1.2", "babel-jest": "14.1.0", "babel-loader": "6.2.4", - "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-plugin-syntax-async-functions": "6.8.0", "babel-plugin-syntax-trailing-function-commas": "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", - "babel-plugin-transform-regenerator": "^6.11.4", + "babel-plugin-transform-regenerator": "6.11.4", "babel-plugin-transform-runtime": "6.12.0", "babel-preset-es2015": "6.9.0", "babel-preset-es2016": "6.11.3",