|
8 | 8 | * @see https://github.com/babel/babel-loader/issues/34 |
9 | 9 | * @see https://github.com/babel/babel-loader/pull/41 |
10 | 10 | */ |
11 | | -const nodeModule = require("node:module"); |
12 | 11 | const os = require("os"); |
13 | 12 | const path = require("path"); |
14 | 13 | const zlib = require("zlib"); |
@@ -44,15 +43,6 @@ let defaultCacheDirectory = null; |
44 | 43 | const gunzip = promisify(zlib.gunzip); |
45 | 44 | const gzip = promisify(zlib.gzip); |
46 | 45 |
|
47 | | -const findRootPackageJSON = () => { |
48 | | - if (nodeModule.findPackageJSON) { |
49 | | - return nodeModule.findPackageJSON("..", __filename); |
50 | | - } else { |
51 | | - // todo: remove this fallback when dropping support for Node.js < 22.14 |
52 | | - return findUpSync("package.json"); |
53 | | - } |
54 | | -}; |
55 | | - |
56 | 46 | /** |
57 | 47 | * Read the contents from the compressed file. |
58 | 48 | * |
@@ -284,7 +274,7 @@ function findCacheDir(name) { |
284 | 274 | if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) { |
285 | 275 | return path.join(env.CACHE_DIR, name); |
286 | 276 | } |
287 | | - const rootPkgJSONPath = findRootPackageJSON(); |
| 277 | + const rootPkgJSONPath = findUpSync("package.json"); |
288 | 278 | if (rootPkgJSONPath) { |
289 | 279 | return path.join( |
290 | 280 | path.dirname(rootPkgJSONPath), |
|
0 commit comments