Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useBuiltIns for @babel/preset-env #1195

Merged
merged 4 commits into from
Apr 4, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ const plugins = basePlugins.concat(
);

const targets = archetype.babel.envTargets[archetype.babel.target];
const hasOtherTargets =
Object.keys(archetype.babel.envTargets)
.sort()
.join(",") !== "default,node";
const useBuiltIns = hasOtherTargets
? { useBuiltIns: "entry", corejs: "2" }
1846689910 marked this conversation as resolved.
Show resolved Hide resolved
: { useBuiltIns: false };
1846689910 marked this conversation as resolved.
Show resolved Hide resolved

const presets = [
//
Expand All @@ -117,7 +124,10 @@ const presets = [
// But keep transforming modules to commonjs when not in production mode so tests
// can continue to stub ES modules.
//
["@babel/preset-env", { modules: isProduction ? "auto" : "commonjs", loose: true, targets }],
[
"@babel/preset-env",
{ modules: isProduction ? "auto" : "commonjs", loose: true, targets, ...useBuiltIns }
],
enableTypeScript && "@babel/preset-typescript",
"@babel/preset-react"
];
Expand Down