tsup is not working with `npx`
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
```
npx tsup x.js --dts --format esm
⠙
Error: Cannot find module 'typescript'
Require stack:
- /Users/himself65/.npm/_npx/7d72304e626f8399/node_modules/tsup/dist/index.js
- /Users/himself65/.npm/_npx/7d72304e626f8399/node_modules/tsup/dist/chunk-CDF4QN4B.js
- /Users/himself65/.npm/_npx/7d72304e626f8399/node_modules/tsup/dist/cli-default.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object. (/Users/himself65/.npm/_npx/7d72304e626f8399/node_modules/tsup/dist/index.js:1021:19)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19)
```
Contributor guide
Research direction
Reproduce the reported `npx tsup x.js --dts --format esm` command and inspect the stack trace entry in `tsup/dist/index.js`, where the missing `typescript` module is reported. Determine the expected dependency behavior for this invocation and verify that the command completes successfully with declaration output and ESM format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100