From 7b43c211d506c7ee9ce952e958472e18dca4cffb Mon Sep 17 00:00:00 2001 From: patrickpircher Date: Fri, 6 Dec 2024 10:08:45 +0100 Subject: [PATCH] always use resolve id and fallback to url --- packages/vite/src/node/plugins/importAnalysis.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index ab404c285b59f2..b15cef105ba909 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -754,15 +754,11 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { const normalizedAcceptedUrls = new Set() for (const { url, start, end } of acceptedUrls) { let normalized - if (url.startsWith('.')) { + const resolved = await this.resolve(url, importerModule.id || undefined) + normalized = resolved?.id + if (!normalized) { const [resolved] = await moduleGraph.resolveUrl(toAbsoluteUrl(url)) normalized = resolved - } else { - const resolved = await this.resolve( - url, - importerModule.id || undefined, - ) - normalized = resolved?.id || url } normalizedAcceptedUrls.add(normalized) const hmrAccept = normalizeHmrUrl(normalized)