Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jul 4, 2023
1 parent 6b796ce commit eecbe97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vite/src/node/ssr/runtimeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class ViteRuntimeClient {
debugTimer = setTimeout(
() =>
warn(
`[vite-node] module ${fsPath} takes over 2s to load.\n${getStack()}`,
`[vite-runtime-client] module ${fsPath} takes over 2s to load.\n${getStack()}`,
),
2000,
)
Expand Down Expand Up @@ -367,12 +367,14 @@ export class ViteRuntimeClient {
return exports
}

if (transformed == null)
if (transformed == null) {
const importer = callstack[callstack.length - 2]
throw new Error(
`[vite-runtime-client] Failed to load "${id}" imported from ${
callstack[callstack.length - 2]
`[vite-runtime-client] Failed to load "${id}"${
importer ? `imported from ${importer}` : ''
}`,
)
}

const modulePath = cleanUrl(moduleId)
// disambiguate the `<UNIT>:/` on windows: see nodejs/node#31710
Expand Down
3 changes: 3 additions & 0 deletions packages/vite/src/node/utils/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ const builtins = new Set([
'wasi',
])

const prefixedBuiltins = new Set(['node:test'])

export function isBuiltin(id: string): boolean {
if (prefixedBuiltins.has(id)) return true
return builtins.has(id.replace(/^node:/, ''))
}

Expand Down

0 comments on commit eecbe97

Please sign in to comment.