Skip to content

fix(vite-plus): search for node_modules/.bin before resolving to native package#223

Merged
Sysix merged 3 commits into
mainfrom
fix(vite-plus)--search-for-`node_modules-bin`-before-resolving-to-native-package
Apr 21, 2026
Merged

fix(vite-plus): search for node_modules/.bin before resolving to native package#223
Sysix merged 3 commits into
mainfrom
fix(vite-plus)--search-for-`node_modules-bin`-before-resolving-to-native-package

Conversation

@Sysix

@Sysix Sysix commented Apr 20, 2026

Copy link
Copy Markdown
Member

When the extension searches for oxlint or oxfmt, it first tried to resolve it via require.resolve, which resulted in a path like:

/home/user/project/node_modules/oxlint/bin/oxlint
/home/user/project/node_modules/.pnpm/oxlint@1.59.0_oxlint-tsgolint@0.20.0/node_modules/oxlint/bin/oxlint

This will execute the binaries with its native settings, without vite-plus context.
With this fix, it will search for node_modules/.bin/oxlint first, which was created by vite-plus itself.

related #215

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the VS Code extension’s binary resolution order so that project-generated wrappers in node_modules/.bin (e.g., created by vite-plus) are preferred over resolving the package’s native/bin entry via require.resolve, ensuring the tools run with the intended vite-plus context.

Changes:

  • Reorders project binary discovery to search node_modules/.bin (workspace + monorepo subfolders) before falling back to require.resolve.
  • Reorders global binary discovery to search global node_modules/.bin before falling back to require.resolve.
Comments suppressed due to low confidence (1)

client/findBinary.ts:101

  • On Windows, node_modules/.bin entries are commonly *.cmd/*.ps1 shims. With this new resolution order, correctness depends on searchNodeModulesDefaultBinPath() choosing a runnable file; today it only checks the extensionless path and .exe, which can select a non-cmd shim and fail to launch under shell: true. Consider updating the .bin candidate list to prefer .cmd (and possibly .ps1) on win32.
  // fallback to direct binary lookup in workspace node_modules/.bin
  const workspaceNodeModules = (workspace.workspaceFolders ?? []).map((folder) =>
    path.join(folder.uri.fsPath, "node_modules"),
  );
  const result = await searchNodeModulesDefaultBinPath(binaryName, workspaceNodeModules);
  if (result) {
    return result;
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/findBinary.ts Outdated
Comment thread client/findBinary.ts Outdated
Comment thread client/findBinary.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/findBinary.ts
Comment thread client/findBinary.ts Outdated
Comment thread client/findBinary.ts
Comment thread client/findBinary.ts
Comment thread client/findBinary.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexander S. <sysix@sysix-coding.de>

@leaysgur leaysgur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@Sysix Sysix merged commit e67a56e into main Apr 21, 2026
4 checks passed
@Sysix Sysix deleted the fix(vite-plus)--search-for-`node_modules-bin`-before-resolving-to-native-package branch April 21, 2026 17:42
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

Successfully merging this pull request may close these issues.

3 participants