Skip to content

Commit f8b9adb

Browse files
committed
fix: restore builtins list
1 parent 104971d commit f8b9adb

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/vite/src/node/utils.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,25 @@ const NODE_BUILTIN_NAMESPACE = 'node:'
9494
const NPM_BUILTIN_NAMESPACE = 'npm:'
9595
// Supported by Bun
9696
const BUN_BUILTIN_NAMESPACE = 'bun:'
97+
//TODO: revisit later to see if the edge case that "compiling using node v12 code to be run in node v16 in the server" is what we intend to support.
98+
const builtins = new Set([
99+
...builtinModules,
100+
'assert/strict',
101+
'diagnostics_channel',
102+
'dns/promises',
103+
'fs/promises',
104+
'path/posix',
105+
'path/win32',
106+
'readline/promises',
107+
'stream/consumers',
108+
'stream/promises',
109+
'stream/web',
110+
'timers/promises',
111+
'util/types',
112+
'wasi',
113+
])
97114
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
98-
const nodeBuiltins = builtinModules.filter((id) => !id.includes(':'))
115+
const nodeBuiltins = [...builtins].filter((id) => !id.includes(':'))
99116

100117
// TODO: Use `isBuiltin` from `node:module`, but Deno doesn't support it
101118
export function isBuiltin(id: string): boolean {

0 commit comments

Comments
 (0)