diff --git a/src/repl.ts b/src/repl.ts index bb1abe83b..2b2cee04e 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -376,7 +376,7 @@ export function createRepl(options: CreateReplOptions = {}) { // Declare node builtins. // Skip the same builtins as `addBuiltinLibsToObject`: // those starting with _ - // those containing / + // those containing / or : // those that already exist as globals // Intentionally suppress type errors in case @types/node does not declare any of them, and because // `declare import` is technically invalid syntax. @@ -384,7 +384,8 @@ export function createRepl(options: CreateReplOptions = {}) { if (!service?.transpileOnly) { state.input += `// @ts-ignore\n${builtinModules .filter( - (name) => !name.startsWith('_') && !name.includes('/') && !['console', 'module', 'process'].includes(name) + (name) => !(name.startsWith('_') || name.includes('/') || name.includes(':') + || ['console', 'module', 'process'].includes(name)) ) .map((name) => `declare import ${name} = require('${name}')`) .join(';')}\n`;