Skip to content

Commit

Permalink
allow fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Dec 17, 2024
1 parent ff09f8b commit d5d7b94
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,19 +769,21 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
normalized = mod.url
} else {
try {
// this fallback is for backward compat and will be removed in Vite 7
const [resolved] = await moduleGraph.resolveUrl(toAbsoluteUrl(url))
normalized = resolved
if (resolved) {
this.warn({
message:
`Failed to resolve ${JSON.stringify(url)} from ${importer}.` +
' An id should be written. Did you pass a URL?',
pos: start,
})
continue
}
} catch {}
this.error(`Failed to resolve ${JSON.stringify(url)}`, start)
return
} catch {
this.error(`Failed to resolve ${JSON.stringify(url)}`, start)
return
}
}
normalizedAcceptedUrls.add(normalized)
const hmrAccept = normalizeHmrUrl(normalized)
Expand Down

0 comments on commit d5d7b94

Please sign in to comment.