-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Typescript compilation error in Node context #11895
Comments
Hey @chadxz 👋 Thanks for opening this! I'll do my best to take a look at this today. I'm currently working on a reproduction for a potential React bug and I'm on vacation starting tomorrow for the next week. If not me, I'll see if one of the other maintainers has some bandwidth to take a look. Thanks! |
Thanks for your patience! There are two things that look like would get this to work for you. Either you'll need to specify your app with import {
ApolloClient,
InMemoryCache,
type NormalizedCacheObject,
} from "@apollo/client/main.cjs"; While this is less than ideal, this should get you what you need for now. We'll be adding proper ESM support in v4 to avoid this issue going forward. Hope this helps! |
Thanks for the suggestion @jerelmiller! I tried this and it looks like that is incompatible with TypeScript as well, unless I'm still missing something: This is using @apollo/[email protected] The same is true on the reproduction link: |
@chadxz thats...odd. I used your original reproduction and forked it to check. Here is my fork: https://codesandbox.io/p/devbox/gifted-thompson-y875p2?file=%2Findex.ts%3A4%2C8 If you run Without Odd that you're still seeing that error in the reproduction 🤔 |
If you hover over the 3 dots at the beginning of the package name in your screenshot you'll probably see the same message I am seeing. I can confirm that compiling works fine in the reproduction, but I think that's because it has a minimal tsconfig.json. If you add |
Also facing this issue, is there any progress? Adding the To confirm, this is with |
+1. I also have this issue with Node16. |
Same issue with NodeNext +1 |
you can add your own package.json "type": "module" |
I just ran into this. Best I can tell, this is because in the |
Issue Description
Trying to upgrade from
3.4.17
to latest and have started running into this error as of3.5.0
:I have included a reproduction link. Simply using
"module": "NodeNext"
in tsconfig.json will cause this. This is the recommended setting for "modern Node.js projects" per the TypeScript documentation. Do you have any recommendations on how to address this? My project is not ESM today.Link to Reproduction
https://codesandbox.io/p/devbox/recursing-yalow-s8fmpr
Reproduction Steps
Run
tsc
in the terminal of the repro. Main config setting to set is"module": "NodeNext"
in tsconfig.json@apollo/client
version3.10.4
The text was updated successfully, but these errors were encountered: