diff --git a/bin/webpack.js b/bin/webpack.js index 2038efebd40..2cef96b2bf4 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -54,13 +54,14 @@ const isInstalled = packageName => { } while (dir !== (dir = path.dirname(dir))); // https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274 - for (const internalPath of require("module").globalPaths) { + // @ts-ignore + for (const internalPath of require("module").globalPaths) { try { - if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) { - return true; - } + if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) { + return true; + } } catch (_error) { - // Nothing + // Nothing } }