-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
node v22.14.0
linux
Reproduction
https://github.com/jcalfee/jiti-cli-min-repo.git
npm i
$ ./src/cli.ts
IT WORKS
$ npx cli
Error: Cannot find module './import-me.ts'
Require stack:
- /home/james/.npm/_npx/0b37f00474a50f52/node_modules/.bin/cli
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Function.resolve (node:internal/modules/helpers:146:19)
at jitiResolve (/home/james/dev/vendor/jiti-link/node_modules/jiti/dist/jiti.cjs:1:187220)
at jitiRequire (/home/james/dev/vendor/jiti-link/node_modules/jiti/dist/jiti.cjs:1:189288)
at import (/home/james/dev/vendor/jiti-link/node_modules/jiti/dist/jiti.cjs:1:199778)
at /home/james/.npm/_npx/0b37f00474a50f52/node_modules/.bin/cli:2:813
at async /home/james/.npm/_npx/0b37f00474a50f52/node_modules/.bin/cli:2:778 {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/james/.npm/_npx/0b37f00474a50f52/node_modules/.bin/cli' ]
}
Extract
$ cat ./src/cli.ts
#!/usr/bin/env jiti
await import('./import-me.ts')
$ egrep cli package.json
"name": "cli",
"cli": "src/cli.ts"
Describe the bug
Just like running form the command line, when running a package.json "bin" target ("cli"), imports should resolve.
Additional context
No response
Logs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working