Skip to content

Commit 74a7f71

Browse files
committed
fix: return resolved id directly if its external url
1 parent ef41e5b commit 74a7f71

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/vite/src/node/plugins/importAnalysis.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
330330
)
331331
}
332332

333-
url = resolved.id
334-
335333
if (isExternalUrl(url)) {
336-
return [url, url]
334+
return [resolved.id, resolved.id]
337335
}
338336

339337
const isRelative = url[0] === '.'
@@ -351,6 +349,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
351349
// an optimized deps may not yet exists in the filesystem, or
352350
// a regular file exists but is out of root: rewrite to absolute /@fs/ paths
353351
url = path.posix.join(FS_PREFIX, resolved.id)
352+
} else {
353+
url = resolved.id
354354
}
355355

356356
// if the resolved id is not a valid browser import specifier,

0 commit comments

Comments
 (0)