From 01d83794c26cd9292974f0836d2565b6d5b78540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 9 Mar 2026 13:18:58 -0400 Subject: [PATCH] revert #1055 --- src/cache.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/cache.js b/src/cache.js index 46d438fd..5a158ee8 100644 --- a/src/cache.js +++ b/src/cache.js @@ -8,7 +8,6 @@ * @see https://github.com/babel/babel-loader/issues/34 * @see https://github.com/babel/babel-loader/pull/41 */ -const nodeModule = require("node:module"); const os = require("os"); const path = require("path"); const zlib = require("zlib"); @@ -44,15 +43,6 @@ let defaultCacheDirectory = null; const gunzip = promisify(zlib.gunzip); const gzip = promisify(zlib.gzip); -const findRootPackageJSON = () => { - if (nodeModule.findPackageJSON) { - return nodeModule.findPackageJSON("..", __filename); - } else { - // todo: remove this fallback when dropping support for Node.js < 22.14 - return findUpSync("package.json"); - } -}; - /** * Read the contents from the compressed file. * @@ -284,7 +274,7 @@ function findCacheDir(name) { if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) { return path.join(env.CACHE_DIR, name); } - const rootPkgJSONPath = findRootPackageJSON(); + const rootPkgJSONPath = findUpSync("package.json"); if (rootPkgJSONPath) { return path.join( path.dirname(rootPkgJSONPath),