4 of 6 standards met
๐ Describe the bug When using @vue/apollo-composable in a Nuxt 3 (Vite) environment with @apollo/client@4.0.12, the application crashes at runtime with the following error: Uncaught (in promise) SyntaxError: The requested module '/_nuxt/node_modules/@apollo/client/legacyEntryPoints/core/index.js' does not provide an export named 'ApolloError' This happens because @vue/apollo-composable imports ApolloError and isApolloError from: @apollo/client/core/index.js In Vite/Nuxt environments, this may resolve to legacyEntryPoints/core, which does not export ApolloError, leading to a runtime failure. ๐ To Reproduce Create a minimal Nuxt 4 project (Vite-based) Install: @vue/apollo-composable@4.2.2 @apollo/client@4.0.12 Trigger an error in a query/mutation (so toApolloError is executed) Run nuxt dev Observe runtime crash due to missing ApolloError export โ Expected behavior ApolloError should be imported from a stable and officially supported entrypoint that guarantees its availability. The application should not crash during error handling. ๐ฆ Versions vue: 3.x @vue/apollo-composable: 4.2.2 @apollo/client: 4.0.12 Nuxt: 4.x Bundler: Vite ๐ Root cause In: packages/vue-apollo-composable/src/util/toApolloError.ts There is: import { ApolloError, isApolloError } from '@apollo/client/core/index.js' However, in Apollo Client v4, ApolloError is exported from: @apollo/client/errors Importing from the core entrypoint is unsafe in modern ESM + Vite environments because it may resolve to legacyEntryPoints, which does not export ApolloError. ๐ก Proposed fix Replace: import { ApolloError, isApolloError } from '@apollo/client/core' With: import { ApolloError, isApolloError } from '@apollo/client/errors' This resolves the issue completely
Repository: vuejs/apollo. Description: ๐ Apollo/GraphQL integration for VueJS Stars: 6055, Forks: 521. Primary language: TypeScript. Languages: TypeScript (42.8%), JavaScript (36.7%), Vue (19.2%), HTML (1.2%), CSS (0.1%). License: MIT. Homepage: http://apollo.vuejs.org Topics: apollographql, graphql, vue, vue2, vuejs, vuejs2. Latest release: v4.2.2 (11mo ago). Open PRs: 10, open issues: 266. Last activity: 3w ago. Community health: 75%. Top contributors: Akryum, dependabot-preview[bot], ydfzgyj, bbugh, Austio, NataliaTepluhina, ciscorn, nickmessing, joe-re, escapedcat and others.
TypeScript
Last 12 weeks ยท 0 commits
Two bugs: In SSR the fetchPolicy is always forced to be ? This makes no sense - what if you invoke the same exact operation from multiple places in the app? is gonna skip cache and re-do the same exact request multiple times. Definitely not good, kinda crazy that this has been in the lib for so long. In SSR, waiting for results relies on , which is OK enough, but not enough for non-component use cases (e.g. Nuxt plugins/middlewares). Instead of just relying on onServerPrefetch, I made it also re-use the same logic CSR uses where if there's cached data already, it returns it immediately.