From b7e7200a81ebaf47dc46889caee3f23170ab3ff1 Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Wed, 20 Mar 2019 10:43:27 -0400 Subject: [PATCH] fix: Don't set corejs for runtime (#96) --- packages/babel-preset/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/babel-preset/index.js b/packages/babel-preset/index.js index 770187d2..4c2d388a 100644 --- a/packages/babel-preset/index.js +++ b/packages/babel-preset/index.js @@ -8,7 +8,6 @@ const intlPreset = require('./intl-preset'); const PRESET_ENV_OPTIONS = [ 'configPath', - 'corejs', 'debug', 'exclude', 'forceAllTransforms', @@ -50,14 +49,12 @@ function addDefaultOptions(explicitOptions) { explicitOptions, ); - if (options.useBuiltIns && !options.corejs) { - // Stay with core-js v2.x for now. - options.corejs = 2; - } + // By default, stay with core-js v2.x for now. + options.envCorejs = options.corejs || 2; if (!options.exclude) { options.exclude = - options.corejs === 2 + options.envCorejs === 2 ? [ // Seems to be added by default with minimum benefit. 'web.dom.iterable', @@ -121,7 +118,13 @@ function preset(api, explicitOptions = {}) { } const presets = [ - [envPreset, pick(options, PRESET_ENV_OPTIONS)], + [ + envPreset, + { + ...pick(options, PRESET_ENV_OPTIONS), + corejs: options.envCorejs, + }, + ], [reactPreset, { development }], ];