Skip to content

Commit

Permalink
chore: only apply lazy cjs module transform on cli and core (#10443)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Sep 27, 2019
1 parent b459f6a commit 5f19704
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions babel.config.js
Expand Up @@ -80,8 +80,7 @@ module.exports = function(api) {
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",

// 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 @@ -92,18 +91,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

0 comments on commit 5f19704

Please sign in to comment.