Bring back deferred require() calls in core and cli (#14028)
This commit is contained in:
parent
2a3b0b9601
commit
3a85ddfb1b
@ -73,6 +73,12 @@ module.exports = function (api) {
|
||||
"eslint/*/test",
|
||||
];
|
||||
|
||||
const lazyRequireSources = [
|
||||
"./packages/babel-cli",
|
||||
"./packages/babel-core",
|
||||
"./packages/babel-preset-env/src/available-plugins.js",
|
||||
];
|
||||
|
||||
switch (env) {
|
||||
// Configs used during bundling builds.
|
||||
case "standalone":
|
||||
@ -191,20 +197,6 @@ module.exports = function (api) {
|
||||
test: ["packages/babel-generator"].map(normalize),
|
||||
plugins: ["babel-plugin-transform-charcodes"],
|
||||
},
|
||||
convertESM && {
|
||||
test: [
|
||||
"./packages/babel-cli",
|
||||
"./packages/babel-core",
|
||||
"./packages/babel-preset-env/src/available-plugins.js",
|
||||
].map(normalize),
|
||||
plugins: [
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
[
|
||||
"@babel/transform-modules-commonjs",
|
||||
{ importInterop: importInteropSrc, lazy: true },
|
||||
],
|
||||
],
|
||||
},
|
||||
convertESM && {
|
||||
test: ["./packages/babel-node/src"].map(normalize),
|
||||
// Used to conditionally import kexec
|
||||
@ -215,8 +207,19 @@ module.exports = function (api) {
|
||||
assumptions: sourceAssumptions,
|
||||
plugins: [transformNamedBabelTypesImportToDestructuring],
|
||||
},
|
||||
convertESM && {
|
||||
test: lazyRequireSources.map(normalize),
|
||||
plugins: [
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
[
|
||||
"@babel/transform-modules-commonjs",
|
||||
{ importInterop: importInteropSrc, lazy: true },
|
||||
],
|
||||
],
|
||||
},
|
||||
convertESM && {
|
||||
test: sources.map(normalize),
|
||||
exclude: lazyRequireSources.map(normalize),
|
||||
plugins: [
|
||||
[
|
||||
"@babel/transform-modules-commonjs",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { parseSync, traverse } from "@babel/core";
|
||||
import { shouldTransform } from "../lib/util.js";
|
||||
import babel from "@babel/core";
|
||||
const { parseSync, traverse } = babel;
|
||||
|
||||
function getPath(input, parserOpts = {}) {
|
||||
let targetPath;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { parseSync, traverse } from "@babel/core";
|
||||
import { shouldTransform } from "../lib/util.js";
|
||||
import babel from "@babel/core";
|
||||
const { parseSync, traverse } = babel;
|
||||
|
||||
function getPath(input, parserOpts = {}) {
|
||||
let targetPath;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { willPathCastToBoolean } from "../lib/util.js";
|
||||
import { parseSync, traverse } from "@babel/core";
|
||||
import babel from "@babel/core";
|
||||
const { parseSync, traverse } = babel;
|
||||
|
||||
function getPath(input, parserOpts) {
|
||||
let targetPath;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user