From cfe0b432f7eca87b970dbb0f7680720ed25d5bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 20 Jul 2020 17:30:00 -0400 Subject: [PATCH] address review comments --- packages/babel-preset-env/src/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index be15fae66028..e3cfb7a623ce 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -278,6 +278,14 @@ export default declare((api, opts) => { const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets; const compatData = getPluginList(shippedProposals, bugfixes); + const shouldSkipExportNamespaceFrom = + (modules === "auto" && api.caller?.(supportsExportNamespaceFrom)) || + (modules === false && + !isRequired("proposal-export-namespace-from", transformTargets, { + compatData, + includes: include.plugins, + excludes: exclude.plugins, + })); const modulesPluginNames = getModulesPluginNames({ modules, transformations: moduleTransformations, @@ -286,15 +294,7 @@ export default declare((api, opts) => { shouldTransformESM: modules !== "auto" || !api.caller?.(supportsStaticESM), shouldTransformDynamicImport: modules !== "auto" || !api.caller?.(supportsDynamicImport), - shouldTransformExportNamespaceFrom: !( - (modules === "auto" && api.caller?.(supportsExportNamespaceFrom)) || - (modules === false && - !isRequired("proposal-export-namespace-from", transformTargets, { - compatData, - includes: include.plugins, - excludes: exclude.plugins, - })) - ), + shouldTransformExportNamespaceFrom: !shouldSkipExportNamespaceFrom, shouldParseTopLevelAwait: !api.caller || api.caller(supportsTopLevelAwait), });