Skip to content

fix(build): invoke tsx directly via node --import instead of npx#3237

Merged
wenshao merged 2 commits into
QwenLM:mainfrom
euxaristia:fix/build-npx-tsx-bun-compat
Apr 18, 2026
Merged

fix(build): invoke tsx directly via node --import instead of npx#3237
wenshao merged 2 commits into
QwenLM:mainfrom
euxaristia:fix/build-npx-tsx-bun-compat

Conversation

@euxaristia

Copy link
Copy Markdown
Contributor

Summary

scripts/build.js calls execSync('npx tsx scripts/generate-settings-schema.ts', ...). When the build is invoked under bun (e.g. `bun run build`), bun's `npx` wrapper intercepts the call and runs `tsx` inside bun's runtime, where tsx's CJS entry fails to resolve with:

```
error: Cannot find module './cjs/index.cjs' from ''
```

Switching to `node --import tsx/esm` bypasses the npx layer and works identically under npm and bun, since `node` is always a real node binary.

Test plan

  • `bun run build` completes successfully
  • `npm run build` still completes successfully
  • `packages/vscode-ide-companion/schemas/settings.schema.json` is regenerated as before

npx resolution breaks when scripts/build.js is invoked under bun
(bun's npx wrapper intercepts and runs tsx inside bun's runtime, where
tsx's CJS entry fails to resolve). Using 'node --import tsx/esm' skips
the npx layer entirely and works under both npm and bun invocation.

@wenshao wenshao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

package.json:22

[Suggestion] The public generate:settings-schema script still uses tsx scripts/generate-settings-schema.ts, while this PR updates scripts/build.js to use node --import tsx/esm ... for the same task. That leaves bun run generate:settings-schema on the old execution path, so the bun compatibility issue remains on another entry point.

Suggested fix:

"generate:settings-schema": "node --import tsx/esm scripts/generate-settings-schema.ts",

— gpt-5.4 via Qwen Code /review

…ript

Matches the approach taken in scripts/build.js so running
`bun run generate:settings-schema` directly bypasses bun's npx wrapper
and avoids the `Cannot find module './cjs/index.cjs'` tsx CJS failure.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@wenshao wenshao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No issues found. LGTM! ✅ — gpt-5.4 via Qwen Code /review

@wenshao wenshao merged commit a623655 into QwenLM:main Apr 18, 2026
13 checks passed
TaimoorSiddiquiOfficial pushed a commit to TaimoorSiddiquiOfficial/HopCode that referenced this pull request Apr 19, 2026
Merged 6 upstream commits while preserving HopCode architecture:

Features synced from upstream:
- feat(mcp): OSC 52 copy hotkey for OAuth authorization URL (QwenLM#3393)
  Press 'c' during OAuth to copy URL via terminal clipboard, works over SSH
- feat(cli): early input capture to prevent keystroke loss during startup (QwenLM#3319)
  Buffers keystrokes during REPL init, replays once UI is mounted
- perf(vscode): fix input lag in long conversations via React.memo (QwenLM#2550)
  MessageList/UserMessage/AssistantMessage wrapped with React.memo
- feat(vscode-ide-companion): agent execution tool display (QwenLM#2590)
  Render dedicated agent execution cards in webview
- fix(build): invoke tsx via node --import instead of npx (QwenLM#3237)
  Fixes bun compatibility for generate:settings-schema script
- ci(stale): enable 35+35 stale/close PR policy (QwenLM#3375)

Conflict resolution:
- packages/vscode-ide-companion/.../toolcalls/index.tsx: kept @hoptrendy/webui,
  added ToolCallData to imports (upstream added it)
- All @qwen-code/* import paths preserved as @hoptrendy/* (HopCode arch)
- HopCode branding, version, and CI workflows preserved

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
…nLM#3237)

* fix(build): invoke tsx directly via node --import instead of npx

npx resolution breaks when scripts/build.js is invoked under bun
(bun's npx wrapper intercepts and runs tsx inside bun's runtime, where
tsx's CJS entry fails to resolve). Using 'node --import tsx/esm' skips
the npx layer entirely and works under both npm and bun invocation.

* fix(build): use node --import tsx/esm for generate:settings-schema script

Matches the approach taken in scripts/build.js so running
`bun run generate:settings-schema` directly bypasses bun's npx wrapper
and avoids the `Cannot find module './cjs/index.cjs'` tsx CJS failure.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

2 participants