diff --git a/Gulpfile.mjs b/Gulpfile.mjs index 3ca307954b18..7637c718b17c 100644 --- a/Gulpfile.mjs +++ b/Gulpfile.mjs @@ -385,17 +385,6 @@ function buildRollup(packages, buildStandalone) { return; } break; - case "NON_EXISTENT_EXPORT": - // babel-core/src/index.ts imports createRequire, but it's only - // used in the ESM build. We can safely ignore this warning. - if ( - warning.id.endsWith("babel-core/src/index.ts") && - warning.source === "\x00polyfill-node.module.js" && - warning.name === "createRequire" - ) { - return; - } - break; } // We use console.warn here since it prints more info than just "warn", diff --git a/packages/babel-core/src/index.ts b/packages/babel-core/src/index.ts index 99b90d035f53..519795f3e459 100644 --- a/packages/babel-core/src/index.ts +++ b/packages/babel-core/src/index.ts @@ -89,11 +89,11 @@ export function Plugin(alias: string) { ); } -import { createRequire } from "module"; +import Module from "module"; import * as thisFile from "./index"; if (USE_ESM) { // Pass this module to the CJS proxy, so that it // can be synchronously accessed. - const cjsProxy = createRequire(import.meta.url)("../cjs-proxy.cjs"); + const cjsProxy = Module.createRequire(import.meta.url)("../cjs-proxy.cjs"); cjsProxy["__ initialize @babel/core cjs proxy __"] = thisFile; }