From 1e9247a96111b55e72a3ef8ac32cc1cf0baadefe Mon Sep 17 00:00:00 2001 From: Charlie Briggs Date: Thu, 9 Nov 2017 10:23:48 +0000 Subject: [PATCH] Replace babel presets with preset-env (#499) This is after running tests to determine that the output is identical for es2015,2016,2016 and es3 code (output string is deepEquals). es3 presets are _not_ included in preset-env, but without configuration it is identical to the es-preset-20xx modules. It would be nice to have some form of snapshot testing to verify this. --- config/webpack.config.js | 6 ++---- package-lock.json | 33 +++++++++++---------------------- package.json | 4 +--- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index fb3a0003..880215f4 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -56,13 +56,11 @@ module.exports = { options: { compact: false, - // TODO: Look into using preset-env instead and specifying our minimum versions + // TODO: Look into specifying our minimum versions in preset-env // for enhanced experience instead of making everything become ES5 presets: [ require.resolve('babel-preset-es3'), - require.resolve('babel-preset-es2015'), - require.resolve('babel-preset-es2016'), - require.resolve('babel-preset-es2017') + require.resolve('babel-preset-env') ], plugins: [ [ diff --git a/package-lock.json b/package-lock.json index 07eccc21..be5b5741 100644 --- a/package-lock.json +++ b/package-lock.json @@ -877,12 +877,14 @@ "babel-types": "6.26.0" } }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "babel-preset-env": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", + "babel-plugin-syntax-trailing-function-commas": "6.22.0", + "babel-plugin-transform-async-to-generator": "6.24.1", "babel-plugin-transform-es2015-arrow-functions": "6.22.0", "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", "babel-plugin-transform-es2015-block-scoping": "6.26.0", @@ -905,24 +907,11 @@ "babel-plugin-transform-es2015-template-literals": "6.22.0", "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", "babel-plugin-transform-es2015-unicode-regex": "6.24.1", - "babel-plugin-transform-regenerator": "6.26.0" - } - }, - "babel-preset-es2016": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2016/-/babel-preset-es2016-6.24.1.tgz", - "integrity": "sha1-+QC/k+LrwNJ235uKtZck6/2Vn4s=", - "requires": { - "babel-plugin-transform-exponentiation-operator": "6.24.1" - } - }, - "babel-preset-es2017": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2017/-/babel-preset-es2017-6.24.1.tgz", - "integrity": "sha1-WXvq37n38gi8/YoS6bKym4svFNE=", - "requires": { - "babel-plugin-syntax-trailing-function-commas": "6.22.0", - "babel-plugin-transform-async-to-generator": "6.24.1" + "babel-plugin-transform-exponentiation-operator": "6.24.1", + "babel-plugin-transform-regenerator": "6.26.0", + "browserslist": "2.5.1", + "invariant": "2.2.2", + "semver": "5.4.1" } }, "babel-preset-es3": { diff --git a/package.json b/package.json index 7f0ce4ba..900cd47c 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,7 @@ "babel-loader": "^7.1.2", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-es2015": "^6.24.1", - "babel-preset-es2016": "^6.24.1", - "babel-preset-es2017": "^6.24.1", + "babel-preset-env": "^1.6.1", "babel-preset-es3": "^1.0.1", "bower": "^1.8.2", "bower-resolve-webpack-plugin": "^1.0.4",