Node.js Inconsistency in VSCode Breaks `tsx` in Extensions
Opened this issue · 0 comments
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.91.1 f1e16e1e6214d7c44d078b1f0607b2388f29d729
- OS Version: macOS 15.1
Issue Description:
The built-in Node.js version in VSCode has been modified and exhibits behavior inconsistent with the official release. Specifically, in the normalizeSpawnArguments
function of the node:child_process
module, the following code exists:
if (process.restrictUNCAccess) {
if (process.uncHostAllowlist.size > 0) {
// Let child process know about UNC allowlist
for (const host of process.uncHostAllowlist) {
if (typeof host !== 'string') {
process.uncHostAllowlist.delete(host);
}
}
const uncHostAllowlist =
ArrayPrototypeJoin(ArrayFrom(process.uncHostAllowlist), '\\');
ArrayPrototypePush(envPairs,
`NODE_UNC_HOST_ALLOWLIST=${uncHostAllowlist}`);
}
} else {
ArrayPrototypePush(envPairs,
'NODE_DISABLE_UNC_ACCESS_CHECKS=1');
}
Moreover, searching for this code on GitHub yields no results (if I missed something, please let me know).
Link: https://github-com/privatenumber/tsx/-/624
The code above causes tsx
to fail to run in VSCode extensions. The full error stack is:
TypeError [Error] [TransformError]: Cannot read properties of undefined (reading 'size')
at normalizeSpawnArguments (node:child_process:726:34)
at Object.spawn (node:child_process:792:13)
at ensureServiceIsRunning (/path/tsx-vscode-ext/node_modules/.pnpm/esbuild-0.21.5/node_modules/esbuild/lib/main.js:1975:29)
at transform (/path/tsx-vscode-ext/node_modules/.pnpm/esbuild-0.21.5/node_modules/esbuild/lib/main.js:1875:37)
at file:///path/tsx-vscode-ext/node_modules/.pnpm/tsx-4.16.2/node_modules/tsx/dist/index-DeKCL_WS.mjs:16:2654
at applyTransformers (file:///path/tsx-vscode-ext/node_modules/.pnpm/tsx-4.16.2/node_modules/tsx/dist/index-DeKCL_WS.mjs:16:1266)
at transform (file:///path/tsx-vscode-ext/node_modules/.pnpm/tsx-4.16.2/node_modules/tsx/dist/index-DeKCL_WS.mjs:16:2601)
at load (file:///path/tsx-vscode-ext/node_modules/.pnpm/tsx-4.16.2/node_modules/tsx/dist/esm/index.mjs?1722219946759:2:2245)
at async nextLoad (node:internal/modules/esm/hooks:833:22)
at async Hooks.load (node:internal/modules/esm/hooks:416:20)
Therefore, I suspect that process.uncHostAllowlist
is undefined
at certain times (possibly when using the module.register
API).
Reproduction Steps:
- Clone the following repository: https://github-com/sxzz/tsx-vscode-ext
- Open the project in VSCode with the ESLint extension installed.
- Check the
Output
tab under the ESLint option to see the aforementioned error.
For more details, please refer to: https://github-com/privatenumber/tsx/-/624