Skip to content

fix: move tsx to runtime dependencies and resolve from script dir#186

Open
Keralin wants to merge 1 commit intotobi:mainfrom
Keralin:fix/tsx-runtime-dependency
Open

fix: move tsx to runtime dependencies and resolve from script dir#186
Keralin wants to merge 1 commit intotobi:mainfrom
Keralin:fix/tsx-runtime-dependency

Conversation

@Keralin
Copy link

@Keralin Keralin commented Feb 16, 2026

Summary

Fixes #182tsx was in devDependencies but is required at runtime by the qmd wrapper script. Global installs via npm install -g or bun install -g skip devDependencies, causing ERR_MODULE_NOT_FOUND immediately on any qmd command.

Changes:

  • package.json: Move tsx from devDependencies to dependencies so it's always installed alongside qmd
  • qmd wrapper: Use explicit path to tsx ESM loader ($SCRIPT_DIR/node_modules/tsx/dist/esm/index.mjs) instead of bare --import tsx specifier, since Node's ESM resolver walks up from CWD — not from the script location — when resolving bare specifiers

Both changes are needed: moving to dependencies ensures tsx is present in qmd's node_modules, and the explicit path ensures Node finds it regardless of the user's current working directory.

tsx is required at runtime by the qmd wrapper script via
`node --import tsx`, but was listed in devDependencies.
Global installs (npm install -g, bun install -g) skip devDependencies,
so tsx was never available after install.

Additionally, Node's ESM resolver walks up from the current working
directory when resolving bare specifiers like `--import tsx`, so even
a separate `npm install -g tsx` doesn't help.

Fix both issues by:
1. Moving tsx from devDependencies to dependencies so it's always
   installed alongside qmd
2. Using an explicit path to tsx's ESM loader in the wrapper script
   instead of a bare specifier, so Node resolves it from qmd's own
   node_modules regardless of CWD

Fixes tobi#182
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.

tsx should be a runtime dependency, not devDependency (breaks npm install -g)

1 participant