How to use the @babel/preset-env.default function in @babel/preset-env

To help you get started, we’ve selected a few @babel/preset-env examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github parcel-bundler / parcel / packages / core / parcel-bundler / src / transforms / babel / env.js View on Github external
if (envCache.has(key)) {
    return envCache.get(key);
  }

  const options = {
    targets,
    modules: false,
    useBuiltIns: useBuiltIns ? 'entry' : false,
    shippedProposals: true,
  };

  if (useBuiltIns) {
    options.corejs = 2;
  }

  let plugins = presetEnv.default({assertVersion: () => true}, options).plugins;

  envCache.set(key, plugins);
  return plugins;
}
github skpm / skpm / packages / babel-preset / index.js View on Github external
module.exports = function buildSkpmPreset(api, options) {
  const transpileTargets =
    (options && options.targets) || buildTargets(options || {})

  const debug =
    options && typeof options.debug === 'boolean' ? !!options.debug : false

  return {
    presets: [
      require('@babel/preset-env').default(api, {
        debug,
        modules: false,
        targets: transpileTargets,
      }),
      require('@babel/preset-react'),
    ],
    plugins: [
      '@babel/plugin-syntax-async-generators',
      '@babel/plugin-proposal-object-rest-spread',
    ],
  }
}