@foxford/babel-preset-react-app
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -37,3 +37,3 @@ /** | ||
var useAbsoluteRuntime = validateBoolOption('absoluteRuntime', opts.absoluteRuntime, true); | ||
var useDebug = validateBoolOption('debug', opts.debug, false); | ||
var isModernBuild = validateBoolOption('mjs', opts.mjs, false); | ||
@@ -46,2 +46,12 @@ | ||
if (opts.targets && typeof targets !== 'object') { | ||
throw new Error('targets must be object as preset-env param'); | ||
} | ||
if (opts.envUseBuiltIns && !['entry', 'usage'].includes(opts.envUseBuiltIns)) { | ||
throw new Error('envUseBuiltIns can be "entry" or "usage"'); | ||
} | ||
var envUsage = opts.envUseBuiltIns || 'entry'; | ||
if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) { | ||
@@ -73,3 +83,4 @@ throw new Error( | ||
// Allow importing core-js in entrypoint and use browserlist to select polyfills | ||
useBuiltIns: 'entry', | ||
useBuiltIns: envUsage, | ||
debug: useDebug, | ||
// Set the corejs version we are using to avoid warnings in console | ||
@@ -79,3 +90,3 @@ corejs: 3, | ||
exclude: ['transform-typeof-symbol'], | ||
targets: isModernBuild ? { esmodules: true } : undefined, | ||
targets: isModernBuild ? { esmodules: true } : opts.targets || undefined, | ||
}, | ||
@@ -82,0 +93,0 @@ ], |
{ | ||
"name": "@foxford/babel-preset-react-app", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Preset babel for foxford js apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -62,2 +62,5 @@ [![Build Status](https://netology-group.semaphoreci.com/badges/babel-preset-react-app/branches/master.svg?style=shields&key=6e65aff2-b9d1-4986-a133-2469c79ef427)](https://netology-group.semaphoreci.com/projects/babel-preset-react-app) | ||
typescript: boolean, | ||
debug: boolean, | ||
envUseBuiltIns: 'entry' | 'usage', | ||
targets: {}, // preset-env targets | ||
mjs: boolean, // esmodules targets for preset-env | ||
@@ -64,0 +67,0 @@ useESModules: boolean, // https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules |
19020
361
83