Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,7 @@ async function bundleConfigFile(
// With the `isNodeBuiltin` check above, this check captures if the builtin is a
// non-node built-in, which esbuild doesn't know how to handle. In that case, we
// externalize it so the non-node runtime handles it instead.
if (isNodeLikeBuiltin(id)) {
if (isNodeLikeBuiltin(id) || id.startsWith('npm:')) {
return { external: true }
}

Expand Down
3 changes: 0 additions & 3 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ export const normalizeId = (id: string): string =>

// Supported by Node, Deno, Bun
const NODE_BUILTIN_NAMESPACE = 'node:'
// Supported by Deno
const NPM_BUILTIN_NAMESPACE = 'npm:'
// Supported by Bun
const BUN_BUILTIN_NAMESPACE = 'bun:'
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
Expand Down Expand Up @@ -136,7 +134,6 @@ export function createIsBuiltin(
export const nodeLikeBuiltins = [
...nodeBuiltins,
new RegExp(`^${NODE_BUILTIN_NAMESPACE}`),
new RegExp(`^${NPM_BUILTIN_NAMESPACE}`),
new RegExp(`^${BUN_BUILTIN_NAMESPACE}`),
]

Expand Down
Loading