Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js Inconsistency in VSCode Breaks tsx in Extensions #51652

Open
vscodenpa opened this issue Jul 31, 2024 · 0 comments
Open

Node.js Inconsistency in VSCode Breaks tsx in Extensions #51652

vscodenpa opened this issue Jul 31, 2024 · 0 comments

Comments

@vscodenpa
Copy link
Owner

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:

  1. Clone the following repository: https://github.com/sxzz/tsx-vscode-ext
  2. Open the project in VSCode with the ESLint extension installed.
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant