From e7abd3510a7d7581f2d12a860766bd596550b946 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 19 May 2017 16:51:15 +0200 Subject: [PATCH] Use babel-runtime as opposed to babel-polyfill (#5662) * Add babel-runtime * Add babel-transform-runtime plugin * Remove babel-polyfill imports * Remove babel-polyfill package * Transform exports to work around webpack 2.2 --- js/.babelrc | 3 ++- js/package.json | 3 ++- js/src/embed.js | 1 - js/src/index.js | 1 - js/src/library.etherscan.js | 1 - js/src/library.shapeshift.js | 1 - js/src/parity.js | 1 - js/webpack/npm.js | 3 --- js/webpack/vendor.js | 1 - 9 files changed, 4 insertions(+), 11 deletions(-) diff --git a/js/.babelrc b/js/.babelrc index 5087af80d..127abf143 100644 --- a/js/.babelrc +++ b/js/.babelrc @@ -7,6 +7,8 @@ "transform-decorators-legacy", "transform-class-properties", "transform-object-rest-spread", + "transform-es2015-modules-commonjs", + "transform-runtime", "lodash", "recharts" ], @@ -25,7 +27,6 @@ }, "test": { "plugins": [ - "transform-runtime", [ "babel-plugin-webpack-alias", { "config": "webpack/test.js" } ] ] } diff --git a/js/package.json b/js/package.json index e2a3841d5..5c203a091 100644 --- a/js/package.json +++ b/js/package.json @@ -77,11 +77,11 @@ "babel-plugin-recharts": "1.1.0", "babel-plugin-transform-class-properties": "6.23.0", "babel-plugin-transform-decorators-legacy": "1.3.4", + "babel-plugin-transform-es2015-modules-commonjs": "6.24.1", "babel-plugin-transform-object-rest-spread": "6.23.0", "babel-plugin-transform-react-remove-prop-types": "0.3.2", "babel-plugin-transform-runtime": "6.23.0", "babel-plugin-webpack-alias": "2.1.2", - "babel-polyfill": "6.23.0", "babel-preset-env": "1.1.9", "babel-preset-es2015": "6.22.0", "babel-preset-es2016": "6.22.0", @@ -159,6 +159,7 @@ }, "dependencies": { "@parity/wordlist": "1.0.1", + "babel-runtime": "6.23.0", "base32.js": "0.1.0", "bignumber.js": "3.0.1", "blockies": "0.0.2", diff --git a/js/src/embed.js b/js/src/embed.js index 75cb5e45a..218bb2f4f 100644 --- a/js/src/embed.js +++ b/js/src/embed.js @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import 'babel-polyfill'; import 'whatwg-fetch'; import es6Promise from 'es6-promise'; diff --git a/js/src/index.js b/js/src/index.js index d1f9ac580..1436f30c0 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import 'babel-polyfill'; import 'whatwg-fetch'; import es6Promise from 'es6-promise'; diff --git a/js/src/library.etherscan.js b/js/src/library.etherscan.js index c4cd9e5f9..1884822e6 100644 --- a/js/src/library.etherscan.js +++ b/js/src/library.etherscan.js @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import 'babel-polyfill/dist/polyfill.js'; import es6Promise from 'es6-promise'; es6Promise.polyfill(); diff --git a/js/src/library.shapeshift.js b/js/src/library.shapeshift.js index ab4b5dedd..6f6f4ccff 100644 --- a/js/src/library.shapeshift.js +++ b/js/src/library.shapeshift.js @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import 'babel-polyfill/dist/polyfill.js'; import es6Promise from 'es6-promise'; es6Promise.polyfill(); diff --git a/js/src/parity.js b/js/src/parity.js index 2305e22a0..9d414f90e 100644 --- a/js/src/parity.js +++ b/js/src/parity.js @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import 'babel-polyfill'; import 'whatwg-fetch'; import es6Promise from 'es6-promise'; diff --git a/js/webpack/npm.js b/js/webpack/npm.js index 2230bf90f..34b91467b 100644 --- a/js/webpack/npm.js +++ b/js/webpack/npm.js @@ -53,9 +53,6 @@ module.exports = { 'node-fetch': 'node-fetch' }, module: { - noParse: [ - /babel-polyfill/ - ], rules: [ { test: /(\.jsx|\.js)$/, diff --git a/js/webpack/vendor.js b/js/webpack/vendor.js index 5081a894f..3270c319c 100644 --- a/js/webpack/vendor.js +++ b/js/webpack/vendor.js @@ -23,7 +23,6 @@ const ENV = process.env.NODE_ENV || 'development'; const DEST = process.env.BUILD_DEST || '.build'; let modules = [ - 'babel-polyfill', 'bignumber.js', 'blockies', 'brace',