From 5f1970433d27916d7795c3877e94d831ff1d7371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Fri, 27 Sep 2019 16:53:27 -0400 Subject: [PATCH] chore: only apply lazy cjs module transform on cli and core (#10443) --- babel.config.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/babel.config.js b/babel.config.js index 2aa9b1a306ee..fe0f90d0bad8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -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: [ { @@ -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