-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
jest failing on react-scripts - needs a CJS build #3
Comments
Huh, yeah I left it untranspiled as in 2019 I didn't think it was strictly necessary. Was thinking I could add support if some users needed it, but didn't expect jest to be a problem / still not have support for ESM. I often use There's some solutions for ESM listed in jestjs/jest#4842 . If |
Supporting TS sounds great. I was going to PR the definitions myself but if that's on the roadmap then I'm guessing there's no need. Regarding CRA, Regarding ava vs. jest & ESM, as tests run in node (most people are on v8 or v10 LTS), ESM need to be transpiled no matter what. Though it is also a common practice to exclude In a nutshell, that's what |
You can, but the TypeScript team themselves has explicitly said to publish types to DefinitelyTyped ( It's on the roadmap but I don't necessarily have a timeline for it. If this issue is high prio, then I'll do it soon. Surface area is pretty small but everything takes time.
Ok, gotcha. I don't use CRA and have my own webpack, etc configs. I thought
AVA supports ESM using
Yes, I know |
- typings now output for TS devs, who overlap a lot with MobX devs! - ESM build now hidden behind `module`, while CJS dev and prod builds are under `main` - CJS appears to still be necessary per #3, but not necessarily for browser support, for _test_ support it's also necessary - unless one is transpiling node_modules or using the `esm` package, Node's support for ESM is still behind a flag / not in LTS - also it may not support `module` field per docs? might need .mjs?
- typings now output for TS devs, who overlap a lot with MobX devs! - ESM build now hidden behind `module`, while CJS dev and prod builds are under `main` - CJS appears to still be necessary per #3, but not necessarily for browser support, for _test_ support it's also necessary - unless one is transpiling node_modules or using the `esm` package, Node's support for ESM is still behind a flag / not in LTS - also it may not support `module` field per docs? might need .mjs?
- typings now output for TS devs, who overlap a lot with MobX devs! - ESM build now hidden behind `module`, while CJS dev and prod builds are under `main` - CJS appears to still be necessary per #3, but not necessarily for browser support, for _test_ support it's also necessary - unless one is transpiling node_modules or using the `esm` package, Node's support for ESM is still behind a flag / not in LTS - also it may not support `module` field per docs? might need .mjs?
Hey @agilgur5 , sorry for the delay on responses, I've got the plate quite full these days. I wasn't aware of ESM ava support via the I'll take a look at the branch in a minute. |
- typings now output for TS devs, who overlap a lot with MobX devs! - ESM build now hidden behind `module`, while CJS dev and prod builds are under `main` - CJS appears to still be necessary per #3, but not necessarily for browser support, for _test_ support it's also necessary - unless one is transpiling node_modules or using the `esm` package, Node's support for ESM is still behind a flag / not in LTS - also it may not support `module` field per docs? might need .mjs?
no worries, I happened to have some time so decided to work on this. will probably go on "OSS hiatus" for a bit as spent a lot of time on OSS recently 😅
Per the Jest issue I linked, Jest can support
Sure and that's one solution. The whole discussion in the community has been whether or not that's a library author's responsibility -- and the answer has been no, and one can't really force authors into doing it, so the tooling has to support it. I've seem multiple ES6+ only packages nowadays. |
CJS builds are released in v0.1.0 |
Just letting you know this is still a issue on CRA when using the default export instead of the named export ( |
arggghhh, that's really annoying -- that means v0.1.0 has an unintentional breaking change... I literally just saw this behavior in jaredpalmer/tsdx#165, but didn't realize it affected Should open this as a separate issue as CJS is now supported, but default exports in CJS isn't At least a few of |
Hi again @agilgur5; since the code is published without transpiling, the ES module syntax is causing jest to error out, as
node_modules
are not transpiled by default. For an straightforwards fix, I'd suggest using @pika/pack`. I can do a PR with the whole setup if that would help :)The text was updated successfully, but these errors were encountered: