tsx
tsx copied to clipboard
`tsx watch --ignore ...` causes `ERR_MODULE_NOT_FOUND` errors
Precheck
- [X] I searched existing issues before opening this one to avoid duplicates
- [X] I'm able to reproduce this issue and prove it with a minimal reproduction
- [X] I understand this is not a place to ask for free debugging support
Problem
Ignoring files with --ignore ./../pkg-a/.next/**/* causes ERR_MODULE_NOT_FOUND error:
$ cd pkg-b
$ pnpm i
Lockfile is up to date, resolution step is skipped
Packages: +2
++
Done in 492ms
~/projects/node-d5jut7/pkg-b
$ pnpm tsx watch --clear-screen=false --ignore ./../pkg-a/.next/**/* index.ts
(node:77) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/projects/node-d5jut7/pkg-a/.next/cache/webpack' imported from /home/projects/node-d5jut7/pkg-b/
at __node_internal_ (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:36:5406)
at new <anonymous> (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:36:4168)
at https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:114:12002
at https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:114:12159
at defaultResolve (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:114:12167)
at nextResolve (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:248:2120)
at h (file:///home/projects/node-d5jut7/pkg-b/node_modules/.pnpm/@[email protected]/node_modules/@esbuild-kit/esm-loader/dist/index.js:19:2612)
at U (file:///home/projects/node-d5jut7/pkg-b/node_modules/.pnpm/@[email protected]/node_modules/@esbuild-kit/esm-loader/dist/index.js:19:1536)
at N (file:///home/projects/node-d5jut7/pkg-b/node_modules/.pnpm/@[email protected]/node_modules/@esbuild-kit/esm-loader/dist/index.js:19:1766)
at h (file:///home/projects/node-d5jut7/pkg-b/node_modules/.pnpm/@[email protected]/node_modules/@esbuild-kit/esm-loader/dist/index.js:19:2711)
at async nextResolve (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:248:2114)
at async ESMLoader.resolve (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:248:7550)
at async ESMLoader.getModuleJob (https://noded5jut7-fpux.w-credentialless.staticblitz.com/blitz.6843a59c.js:248:4376) {
code: 'ERR_MODULE_NOT_FOUND'
}
Removing the --ignore option causes the program to run through:
$ pnpm tsx watch index.ts
a 1
Expected behavior
Imported modules / packages / files can still be located if they are a part of the --ignore specifier
Minimal reproduction URL
https://stackblitz.com/edit/node-d5jut7?file=pkg-b%2Findex.ts&file=pkg-a%2F.next%2Fcache%2Fwebpack%2Ffile.ts
Version
v4.5.0
Node.js version
v18.18.0
Package manager
pnpm
Operating system
Linux
Contributions
- [ ] I plan to open a pull request for this issue
- [ ] I plan to make a financial contribution to this project