From b48c1d11fe71dff22adb094e729addd0e8b50dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sun, 15 Sep 2019 18:06:09 -0400 Subject: [PATCH] perf: only apply lazy cjs module transform on cli and core --- babel.config.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/babel.config.js b/babel.config.js index 82966a7f07ca..2fdd10f6e70d 100644 --- a/babel.config.js +++ b/babel.config.js @@ -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: [ { @@ -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