Commit 1597170 1 parent 103820f commit 1597170 Copy full SHA for 1597170
File tree 1 file changed +7
-6
lines changed
packages/vite/src/node/ssr
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -291,8 +291,8 @@ async function nodeImport(
291
291
metadata ?: SSRImportMetadata ,
292
292
) {
293
293
let url : string
294
- const isRuntimeHandled = id . startsWith ( 'data:' ) || isBuiltin ( id )
295
- if ( isRuntimeHandled ) {
294
+ let filePath : string | undefined
295
+ if ( id . startsWith ( 'data:' ) || isBuiltin ( id ) ) {
296
296
url = id
297
297
} else {
298
298
const resolved = tryNodeResolve (
@@ -310,24 +310,25 @@ async function nodeImport(
310
310
err . code = 'ERR_MODULE_NOT_FOUND'
311
311
throw err
312
312
}
313
+ filePath = resolved . id
313
314
url = pathToFileURL ( resolved . id ) . toString ( )
314
315
}
315
316
316
317
const mod = await import ( url )
317
318
318
319
if ( resolveOptions . legacyProxySsrExternalModules ) {
319
320
return proxyESM ( mod )
320
- } else if ( isRuntimeHandled ) {
321
- return mod
322
- } else {
321
+ } else if ( filePath ) {
323
322
analyzeImportedModDifference (
324
323
mod ,
325
- url ,
324
+ filePath ,
326
325
id ,
327
326
metadata ,
328
327
resolveOptions . packageCache ,
329
328
)
330
329
return proxyGuardOnlyEsm ( mod , id )
330
+ } else {
331
+ return mod
331
332
}
332
333
}
333
334
You can’t perform that action at this time.
0 commit comments