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

perf: only apply lazy cjs module transform on cli and core #10443

Merged
merged 1 commit into from Sep 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions babel.config.js
Expand Up @@ -78,8 +78,7 @@ module.exports = function(api) {
{ useBuiltIns: true, loose: true },
],

// Explicitly use the lazy version of CommonJS modules.
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
convertESM ? "@babel/transform-modules-commonjs" : null,
].filter(Boolean),
overrides: [
{
Expand All @@ -90,18 +89,17 @@ module.exports = function(api) {
],
},
{
test: "./packages/babel-register",
test: ["./packages/babel-cli", "./packages/babel-core"],
plugins: [
// Override the root options to disable lazy imports for babel-register
// because otherwise the require hook will try to lazy-import things
// leading to dependency cycles.
convertESM ? "@babel/transform-modules-commonjs" : null,
// Explicitly use the lazy version of CommonJS modules.
convertESM
? ["@babel/transform-modules-commonjs", { lazy: true }]
: null,
].filter(Boolean),
},
{
test: "./packages/babel-polyfill",
presets: [["@babel/env", envOptsNoTargets]],
plugins: [["@babel/transform-modules-commonjs", { lazy: false }]],
},
{
// The vast majority of our src files are modules, but we use
Expand Down