-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
ERR_UNSUPPORTED_DIR_IMPORT
with apollo-angular and @apollo/client
#15795
Comments
The way |
I think it's likely that apollo's documentation is "incorrect" in a sense that it's not considering less-forgiving NodeJs's ESM resolution. It might have worked on Jest, but Vitest doesn't intercept the way https://stackblitz.com/edit/vitest-dev-vitest-smbxnz?file=repro.mjs // node repro.mjs
import * as Apollo from 'apollo-angular';
console.log(Apollo.APOLLO_NAMED_OPTIONS.toString()); To align with ESM resolution spec, probably it needs to be I expect the change is required on apollo side, but let's see how it goes kamilkisiela/apollo-angular#2172. |
At least this doesn't look like a Vite issue, so let me close this. |
Thanks @hi-ogawa - I opened apollographql/apollo-client#11569 Is there any workaround I could use with Vitest meanwhile? I'm new to Vite's config system and tried |
Thanks for reporting the issue on Apollo. Interesting, they already had the same issue reported before. Hope you'll get some reaction there.
Unfortunately You'll probably see the documentation saying "external" in many places (for example this warning https://vitejs.dev/config/shared-options.html#resolve-alias) and this is what it means by "external" or "externalized". "Externalizing" is the default behavior but you can control it by I just tested https://stackblitz.com/edit/vitest-dev-vitest-5dnvv6?file=vite.config.ts |
Describe the bug
I've been experimenting with migrating a test suite from
jest
over tovitest
for an Angular project and ran into a weird issue. Withjest
everything works properly, as does with the angular cli (which doesn't use Vite yet, but they're migrating to it)Error is:
This could be
vite
related.See below for a simple repro.
Reproduction
https://stackblitz.com/~/edit/vitest-dev-vitest-djnid1?initialPath=/__vitest__/
Steps to reproduce
No response
System Info
System: OS: Linux 5.0 undefined CPU: (5) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.18.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.14.0 - /usr/local/bin/pnpm npmPackages: vite: latest => 5.0.12
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: