-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
explicitly provide cjs type #247
Comments
Hey @marklai1998, thanks for reporting the issue 👋 I did indeed reproduce by using ESM modules syntax in plain Is there a reason why you are not using CJS in the first place inside your typescript files? It appears that it is quite hard to produce both esm and cjs from a single set of I read several discussions about the issue in the typescript repo, and it seems like they are unwilling to improve the situation and recommend avoiding mixing the two styles. I'll try to find a way to produce dual cjs/esm output anyway, but it may take some time ⌛. |
@elbywan hi, I think its nothing to do with syntax, because you're doing I see the project also does provide both cjs and esm build, but the issue seems to be with As for the reason, my company has a lot of nestjs project that has incompatible with ESM(require in ESM is not supported) |
Faker.js also facing this issue and I see there is a new PR ppl trying to fix it with .d.cts as well, sounds promising |
It think that has everything to do with it because typescript uses the subpath exports defined in the wretch package.json file that are syntax dependent. Using Producing Anyway the good news is that I think that I found a proper, mostly clean solution that seems to be working fine: c7f00fc I'll release it shortly after testing it thoroughly. |
When importing wretch in a typescript project where target is set to cjs will yield the following error:
the error is cause by hybriding cjs and esm and mark type: "module"
1 of the suggestion I can find so far is to explicitly generate a
.d.cts
file and update package.json to point to itmicrosoft/TypeScript#53045
The text was updated successfully, but these errors were encountered: