kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

`ERR_UNSUPPORTED_DIR_IMPORT` or `EISDIR` with `vitest` #2172

Open andreialecu opened 7 months ago

andreialecu commented 7 months ago

Describe the bug

It appears that when using vitest via https://analogjs.org/docs/features/testing/vitest the test suite will run into bizarre issues due to the way this library imports @apollo/client/core.

I'm not sure if it's a bug in this library or in vite/vitest. I also opened a bug report on their side: https://github.com/vitejs/vite/issues/15795

To Reproduce

Repro at: https://stackblitz.com/~/edit/vitest-dev-vitest-djnid1?initialPath=/__vitest__/

Expected behavior

No error

andreialecu commented 7 months ago

It appears the "correct" way is to change all the imports to @apollo/client/core/index.js as per: https://github.com/apollographql/apollo-client/pull/11570#issuecomment-1926627256