diff --git a/build/babel-helpers.js b/build/babel-helpers.js new file mode 100644 index 0000000000..30a5156771 --- /dev/null +++ b/build/babel-helpers.js @@ -0,0 +1,14 @@ +'use strict' + +// These are the babel helpers we whitelist +const helpers = [ + 'createClass', + 'createSuper', + 'defineProperties', + 'defineProperty', + 'getPrototypeOf', + 'inheritsLoose', + 'objectSpread2' +] + +module.exports = helpers diff --git a/build/build-plugins.js b/build/build-plugins.js index 47527ed7b6..30c2c80179 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -11,21 +11,14 @@ const path = require('path') const rollup = require('rollup') const babel = require('rollup-plugin-babel') const banner = require('./banner.js') +const babelHelpers = require('./babel-helpers.js') const plugins = [ babel({ // Only transpile our source code exclude: 'node_modules/**', // Include only required helpers - externalHelpersWhitelist: [ - 'createClass', - 'createSuper', - 'defineProperties', - 'defineProperty', - 'getPrototypeOf', - 'inheritsLoose', - 'objectSpread2' - ] + externalHelpersWhitelist: babelHelpers }) ] const bsPlugins = { diff --git a/build/rollup.config.js b/build/rollup.config.js index a7c3a6f5a4..d32346e101 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -4,6 +4,7 @@ const path = require('path') const babel = require('rollup-plugin-babel') const resolve = require('@rollup/plugin-node-resolve') const banner = require('./banner.js') +const babelHelpers = require('./babel-helpers.js') const BUNDLE = process.env.BUNDLE === 'true' const ESM = process.env.ESM === 'true' @@ -15,15 +16,7 @@ const plugins = [ // Only transpile our source code exclude: 'node_modules/**', // Include only required helpers - externalHelpersWhitelist: [ - 'createClass', - 'createSuper', - 'defineProperties', - 'defineProperty', - 'getPrototypeOf', - 'inheritsLoose', - 'objectSpread2' - ] + externalHelpersWhitelist: babelHelpers }) ] const globals = { diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js index c9826c05ea..af90a958ff 100644 --- a/js/tests/karma.conf.js +++ b/js/tests/karma.conf.js @@ -9,6 +9,7 @@ const { browsers, browsersKeys } = require('./browsers') +const babelHelpers = require('../../build/babel-helpers.js') const { env } = process const browserStack = env.BROWSER === 'true' @@ -72,14 +73,7 @@ const conf = { // Only transpile our source code exclude: 'node_modules/**', // Include only required helpers - externalHelpersWhitelist: [ - 'defineProperties', - 'createClass', - 'createSuper', - 'inheritsLoose', - 'defineProperty', - 'objectSpread2' - ], + externalHelpersWhitelist: babelHelpers, plugins: [ '@babel/plugin-proposal-object-rest-spread' ]