chore: only apply lazy cjs module transform on cli and core (#10443)
This commit is contained in:
parent
b459f6a0a4
commit
5f1970433d
@ -80,8 +80,7 @@ module.exports = function(api) {
|
|||||||
"@babel/plugin-proposal-optional-chaining",
|
"@babel/plugin-proposal-optional-chaining",
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
|
|
||||||
// Explicitly use the lazy version of CommonJS modules.
|
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||||
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
@ -92,18 +91,17 @@ module.exports = function(api) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: "./packages/babel-register",
|
test: ["./packages/babel-cli", "./packages/babel-core"],
|
||||||
plugins: [
|
plugins: [
|
||||||
// Override the root options to disable lazy imports for babel-register
|
// Explicitly use the lazy version of CommonJS modules.
|
||||||
// because otherwise the require hook will try to lazy-import things
|
convertESM
|
||||||
// leading to dependency cycles.
|
? ["@babel/transform-modules-commonjs", { lazy: true }]
|
||||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
: null,
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: "./packages/babel-polyfill",
|
test: "./packages/babel-polyfill",
|
||||||
presets: [["@babel/env", envOptsNoTargets]],
|
presets: [["@babel/env", envOptsNoTargets]],
|
||||||
plugins: [["@babel/transform-modules-commonjs", { lazy: false }]],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// The vast majority of our src files are modules, but we use
|
// The vast majority of our src files are modules, but we use
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user