Skip to content
PluginStats

vite-plugin-graphql-loader weekly downloads statistics

By 0x31 · npm · Vite plugins

A Vite plugin for loading GraphQL files.

View on npm Fresh · Dec 6, 2026

vite-plugin-graphql-loader has 122,924 recorded weekly downloads on npm, a decrease of 10.2% over the past 30 days, ranking #609 of 3,247 tracked listings.

Weekly downloads
122,924
Official API · Dec 5, 2026
7-day growth
+0.7%
+860 weekly downloads
30-day growth
-10.2%
-13.9K weekly downloads
90-day growth
+2.0%
+2.5K weekly downloads
Rank
#609
▼ 20 in 7 days

About vite-plugin-graphql-loader

vite-plugin-graphql-loader

License Version Downloads Vite Badge GraphQL Badge TypeScript Badge

A Vite plugin for loading GraphQL .gql and .graphql files, based on graphql-tag/loader

Using Bun as well? bun-graphql-loader is the same loader behind Bun's plugin API, built from the same source in this repository.

This package doesn't generate TypeScript definitions from the queries and fragments - see vite-plugin-graphql-codegen if you require this.

Install

yarn add -D vite-plugin-graphql-loader graphql

or

npm i --save-dev vite-plugin-graphql-loader graphql
Compatibility
PeerSupported
graphql16.x, 17.x
vite5.x, 6.x, 7.x, 8.x
Node^20.19.0 || >=22.12.0 (GraphQL 17 itself requires Node 22+)

Usage

In vite.config.ts or vite.config.js:

import { defineConfig } from "vite";
import graphqlLoader from "vite-plugin-graphql-loader";

export default defineConfig({
    plugins: [graphqlLoader()],
});

Now you can import queries from .gql or .graphql files.

example.graphql:

#import "./ExampleImport.graphql"

fragment ExampleFragment on example {
    id
    name
}

query ExampleQuery {
    example {
        ...ExampleFragment
        ...ExampleImport
    }
}

example.js:

import ExampleQuery, { ExampleFragment } from "./example.graphql";

If you have multiple queries in the same file, import them like this:

import { FirstQuery, SecondQuery } from "./example.graphql";

TypeScript

If you are using TypeScript, you will have to declare .gql or .graphql files.

Create graphql.d.ts anywhere in your source directory:

declare module "*.gql";
declare module "*.graphql";

Alternatively, for full type information (replacing .gql with .graphql depending on what you use):

declare module "*.gql" {
    const Query: import("graphql").DocumentNode;
    export default Query;
    export const _queries: Record<string, import("graphql").DocumentNode>;
    export const _fragments: Record<string, import("graphql").DocumentNode>;
}

Every export is a DocumentNode. A fragment export is a document holding that fragment and the fragments it spreads, which is what gql interpolation and fragment composition expect.

import Document, { _queries, _fragments } from "./example.graphql";
console.log(Document); // Has type `DocumentNode`
console.log(_queries.ExampleQuery); // Has type `DocumentNode`
console.log(_fragments.ExampleFragment); // Has type `DocumentNode`

An operation whose name is a JavaScript reserved word has to be renamed on import:

import { delete as deleteThing } from "./things.graphql";

Changelog

v6.0.0:…

Description from the npm listing.

  • graphql
  • vite
  • vite-plugin

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vite-plugin-graphql-loader weekly downloads on npm, last 90 days: 122,924 weekly downloads as of Dec 5, 2026, +2.0% over 90 days.vite-plugin-graphql-loaderWeekly downloads on npm · Last 90 days122,924downloads / week+2.0% over 90 days020K40K60K80K100K120K140K160KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vite-plugin-graphql-loader weekly downloads on npm, last 90 days: 122,924 weekly downloads as of Dec 5, 2026, +2.0% over 90 days.

7/30/90-day growth

vite-plugin-graphql-loader weekly downloads growth on npm: +0.7% over 7 days, -10.2% over 30 days, +2.0% over 90 days.vite-plugin-graphql-loaderWeekly downloads growth on npm122,924downloads / week now7-day growth+860 weekly downloads+0.7%30-day growth-13,911 weekly downloads-10.2%90-day growth+2,467 weekly downloads+2.0%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-graphql-loader weekly downloads growth on npm: +0.7% over 7 days, -10.2% over 30 days, +2.0% over 90 days.

Ranking history

vite-plugin-graphql-loader npm ranking history: currently #609 (by weekly downloads).vite-plugin-graphql-loadernpm ranking · by weekly downloads · Last 90 days#609current rank#540#560#580#600#620#640#660#680Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-graphql-loader npm ranking history: currently #609 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 31, #9 (overall #609)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins300 listings · 15 pages · page 5, #17 (overall #97)
Vite plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for vite-plugin-graphql-loader
Date (UTC)Weekly downloadsChange vs. previous
122,924-1.3K
124,185+5K
119,192+6.3K
112,846+2.6K
110,198-6.1K
116,317-2.6K
118,964-3.1K
122,064-5.2K
127,254-13.1K
140,385-10.6K
150,946-3.3K
154,219-468
154,687-166
154,853—

Similar npm Vite plugins plugins

All 20 vite-plugin-graphql-loader alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vite-plugin-graphql-loader. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.