A small and fast GraphQL client for Vue.js, version 3.5.2. It provides a minimal composable-based API for querying GraphQL APIs, with built-in caching, deduplication, and batch support. Unlike Apollo Client, villus is lightweight and focused, offering plugins for subscriptions and file uploads. It ships TypeScript types and supports Vue 2.7+ and 3.x, with Suspense support. Compatible with GraphQL 0.11-16. Released actively, with frequent updates.
npm install villusNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a villus client and executes a simple GraphQL query in a Vue 3 component using the Composition API.
Remove variable assignment from useClient(). For multiple clients, use 'villus/multi-client' subpackage.
Access data via data.value in script, or use v-if in template to wait for data.
Pass cachePolicy to the 'cache' plugin: import { cache } from 'villus' and use plugins: [cache({ policy: 'cache-and-network' })].Install unfetch (client) or node-fetch (server) and assign to globalThis.fetch.
Ensure useClient() is called in a parent component (e.g., App.vue) before any child uses useQuery.
Install villus: npm install villus graphql. Ensure tsconfig has 'moduleResolution': 'node' and 'esModuleInterop': true.
Access data as a ref: data.value in <script setup> or use v-if in template.
No dependency data recorded yet.