Skip to content

Commit

Permalink
always use resolve id and fallback to url
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Dec 6, 2024
1 parent 6f18c1b commit 7b43c21
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,15 +754,11 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
const normalizedAcceptedUrls = new Set<string>()
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)
Expand Down

0 comments on commit 7b43c21

Please sign in to comment.