























@@ -231,7 +231,14 @@ function listArgvRuntimeFallbackStartDirs(argv1: string | undefined): string[] {
231231return [];
232232}
233233const normalized = path.resolve(argv1);
234-const starts = [path.dirname(normalized)];
234+const starts: string[] = [];
235+const parts = normalized.split(path.sep);
236+const binIndex = parts.lastIndexOf(".bin");
237+if (binIndex > 0 && parts[binIndex - 1] === "node_modules") {
238+const binName = path.basename(normalized);
239+const nodeModulesDir = parts.slice(0, binIndex).join(path.sep);
240+starts.push(path.join(nodeModulesDir, binName));
241+}
235242try {
236243const resolved = fs.realpathSync(normalized);
237244if (resolved !== normalized) {
@@ -240,13 +247,7 @@ function listArgvRuntimeFallbackStartDirs(argv1: string | undefined): string[] {
240247} catch {
241248// Keep the unresolved argv path; startup shims may not exist in tests.
242249}
243-const parts = normalized.split(path.sep);
244-const binIndex = parts.lastIndexOf(".bin");
245-if (binIndex > 0 && parts[binIndex - 1] === "node_modules") {
246-const binName = path.basename(normalized);
247-const nodeModulesDir = parts.slice(0, binIndex).join(path.sep);
248-starts.push(path.join(nodeModulesDir, binName));
249-}
250+starts.push(path.dirname(normalized));
250251return dedupeResolvedPaths(starts);
251252}
252253@@ -1087,7 +1088,7 @@ export function resolvePluginRuntimeModulePathWithDiagnostics(
10871088const argv1 = params.argv1 ?? process.argv[1];
10881089candidates.push(
10891090 ...listAncestorPluginRuntimeModuleCandidates({
1090-starts: [...listArgvRuntimeFallbackStartDirs(argv1), params.cwd],
1091+starts: listArgvRuntimeFallbackStartDirs(argv1),
10911092 orderedKinds,
10921093}),
10931094);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。