From 5f747e1a90e77cce93732636a8f994447b0aeac4 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 10:57:10 +0100 Subject: [PATCH] Remove transform-runtime We use instance methods (or at least, draft.js does) so we need babel-polyfill instead. --- .babelrc | 3 +-- package.json | 2 ++ src/vector/index.js | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index c30cbe08cb..fb2f03c450 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,3 @@ { - "presets": ["react", "es2015", "es2016", "es2017", "stage-2"], - "plugins": ["transform-runtime"] + "presets": ["react", "es2015", "es2016", "es2017", "stage-2"] } diff --git a/package.json b/package.json index cf2778ac46..417f0d775a 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "test:multi": "karma start" }, "dependencies": { + "babel-polyfill": "^6.5.0", "babel-runtime": "^6.11.6", "browser-request": "^0.3.3", "classnames": "^2.1.2", @@ -66,6 +67,7 @@ "babel-eslint": "^6.1.0", "babel-loader": "^6.2.5", "babel-plugin-transform-runtime": "^6.15.0", + "babel-polyfill": "^6.5.0", "babel-preset-es2015": "^6.16.0", "babel-preset-es2016": "^6.16.0", "babel-preset-es2017": "^6.16.0", diff --git a/src/vector/index.js b/src/vector/index.js index 00f517fc53..bb33f656c5 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -16,6 +16,15 @@ limitations under the License. 'use strict'; +// for ES6 stuff like startsWith() that Safari doesn't handle +// and babel doesn't do by default +// Note we use this, not the babel transform-runtime plugin +// since transform-runtime does not cover instance methods +// such as "foobar".includes("foo") which bits of our library +// code use. +// https://babeljs.io/docs/plugins/transform-runtime/ +require('babel-polyfill'); + // CSS requires: just putting them here for now as CSS is going to be // refactored soon anyway require('../../vector/components.css');