Skip to content

Commit eecbe97

Browse files
committed
chore: cleanup
1 parent 6b796ce commit eecbe97

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/vite/src/node/ssr/runtimeClient.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export class ViteRuntimeClient {
268268
debugTimer = setTimeout(
269269
() =>
270270
warn(
271-
`[vite-node] module ${fsPath} takes over 2s to load.\n${getStack()}`,
271+
`[vite-runtime-client] module ${fsPath} takes over 2s to load.\n${getStack()}`,
272272
),
273273
2000,
274274
)
@@ -367,12 +367,14 @@ export class ViteRuntimeClient {
367367
return exports
368368
}
369369

370-
if (transformed == null)
370+
if (transformed == null) {
371+
const importer = callstack[callstack.length - 2]
371372
throw new Error(
372-
`[vite-runtime-client] Failed to load "${id}" imported from ${
373-
callstack[callstack.length - 2]
373+
`[vite-runtime-client] Failed to load "${id}"${
374+
importer ? `imported from ${importer}` : ''
374375
}`,
375376
)
377+
}
376378

377379
const modulePath = cleanUrl(moduleId)
378380
// disambiguate the `<UNIT>:/` on windows: see nodejs/node#31710

packages/vite/src/node/utils/shared.ts

+3
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ const builtins = new Set([
180180
'wasi',
181181
])
182182

183+
const prefixedBuiltins = new Set(['node:test'])
184+
183185
export function isBuiltin(id: string): boolean {
186+
if (prefixedBuiltins.has(id)) return true
184187
return builtins.has(id.replace(/^node:/, ''))
185188
}
186189

0 commit comments

Comments
 (0)