Electron Script Fails with ERR_UNKNOWN_FILE_EXTENSION on Node.js
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.139.0-dev (commit `b0dad94048b3b988c8aa325a46ce7998f2abe0bb`, Node.js v22.17.0)
- OS Version: Windows 11 (Microsoft Windows NT 10.0.26200.0)
### Description
Invoking `npm run electron` or running the test suite via `./scripts/test.bat` fails immediately on Node.js v22 with `TypeError [ERR_UNKNOWN_FILE_EXTENSION]`. The `package.json` script `"electron"` directly invokes `node build/lib/electron.ts` without passing `--experimental-strip-types`, causing Node's ESM loader to reject the `.ts` extension before execution begins.
### Steps to Reproduce:
1. Open a terminal in the root repository checkout (`vscode`).
2. Run `npm run electron` or execute `./scripts/test.bat`.
3. Observe the immediate `ERR_UNKNOWN_FILE_EXTENSION` error from Node.js:
```text
> code-oss-dev@1.139.0 electron
> node build/lib/electron.ts
node:internal/modules/esm/get_format:219
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for D:\vscode\build\lib\electron.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:219:9)
at defaultGetFormat (node:internal/modules/esm/get_format:245:36)
at defaultLoad (node:internal/modules/esm/load:120:22)
at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:580:32)
at async ModuleJob._link (node:internal/modules/esm/module_job:154:19) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Node.js v22.17.0
```
Contributor guide
Assessment
This issue has not been assessed yet.