Weird interaction between CJS and ESM for JSON modules
bugpending triage
### Acknowledgements
- [x] I read the documentation and searched existing issues to avoid duplicates
- [x] I understand this is a **bug tracker** and anything other than a proven bug will be closed
- [x] I understand this is a free project and relies on community contributions
- [x] I read and understood the [Contribution guide](https://github.com/privatenumber/tsx/blob/master/CONTRIBUTING.md)
### Minimal reproduction URL
I provided the exact source below; I don't have a StackBlitz to upload it there.
### Problem & expected behavior (under 200 words)
Make sure to use `yarn`.
`package.lock`:
```
{
"name": "example",
"version": "1.0.0",
"type": "module",
"packageManager": "yarn@4.14.1",
"dependencies": {
"http-errors": "^2.0.1"
},
"devDependencies": {
"@types/http-errors": "^2",
"tsx": "^4.22.3"
}
}
```
`src/index.ts`:
```
import { errors } from "./errors.js";
errors;
```
`src/errors.ts`:
```
import { isHttpError } from "http-errors";
export const errors = () => {
isHttpError;
};
```
Run:
- `yarn install`
- `yarn tsx src/index.ts`
### Bugs are expected to be fixed by those affected by it
- [ ] I'm interested in working on this issue
### Compensating engineering work will speed up resolution and support the project
- [ ] I'm willing to offer $10 for financial support
0 条评论