Skip to content
PluginStats

vite-plugin-relay weekly downloads statistics

By oscartbeaumont · npm · Vite plugins

A vite plugin for relay

View on npm Fresh · Dec 6, 2026

vite-plugin-relay has 67,896 recorded weekly downloads on npm, a decrease of 18.1% over the past 30 days, ranking #712 of 3,247 tracked listings.

Weekly downloads
67,896
Official API · Dec 5, 2026
7-day growth
-10.4%
-7.9K weekly downloads
30-day growth
-18.1%
-15K weekly downloads
90-day growth
+53.3%
+23.6K weekly downloads
Rank
#712
▼ 39 in 7 days

About vite-plugin-relay

<h1 align="center">Vite Plugin Relay</h1> <div align="center">

NPM CI workflow

</div> <div align="center"> Add relay support to your <a href="https://vitejs.dev">Vite</a> projects. </div> <br />

❤️ Special thanks to:

I do not actively use this project anymore, however, it will still receive periodic updates.

Usage

Follow Relay's guide on how to add Relay to your project.

⚠️ Note: Install babel-plugin-relay (>= 13.0.1) as devDependencies as instructed, but skip its configuration. vite-plugin-relay will invoke the babel plugin for you!

Add vite-plugin-relay to your devDependencies:

yarn add vite-plugin-relay -D

Add vite-plugin-relay to your Vite configuration (vite.config.ts or vite.config.js):

import { defineConfig } from "vite";
import relay from "vite-plugin-relay";

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

If babel-plugin-relay cannot discover your Relay config by itself (see Monorepos, workspaces and multi-project configs), pass the options explicitly with createRelayPlugin instead:

import { defineConfig } from "vite";
import { createRelayPlugin } from "vite-plugin-relay";

export default defineConfig({
  plugins: [
    ...,
    createRelayPlugin({
      artifactDirectory: "./src/__generated__",
      eagerEsModules: true,
    }),
  ],
});

Configure relay-compiler to output artifacts with export default syntax, by setting eagerEsModules to true:

{
  "relay": {
    "src": "./src",
    "schema": "./src/schema.graphql",
    "language": "typescript",
    "eagerEsModules": true,
    "exclude": ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]
  }
}

Now your project is setup to use Relay with Vite!

How this plugin works

Under the hood we are invoking the official babel-plugin-relay. This ensures that our plugin and babel-plugin-relay do not get out of sync over time and also reduces the maintainance costs of this project.

Since v13 babel-plugin-relay automatically gets its configuration from either the package.json, relay.config.js or relay.config.json, so our plugin also doesn't have to expose a configuration API. It searches for that config starting from the current working directory, which works for most projects but not all (see below). When it guesses wrong, use createRelayPlugin(options) to pass the options explicitly.

Monorepos, workspaces and multi-project configs

babel-plugin-relay reads its config from the process working directory and only understands the top-level eagerEsModules/artifactDirectory options. That breaks in a few setups:

  • Vitest workspaces / monorepos where Vite is run from the repository root, so the working directory is not the package directory and the package's relay.config.js is never found.
  • Multi-project Relay configs (the projects/sources format). eagerEsModules and the artifact directory are configured per project and are ignored, which shows up as ReferenceError: require is not defined in the browser when babel-plugin-relay emits a require() call.

For these, pass the options yourself with createRelayPlugin:

import { createRelayPlugin } from "vite-plugin-relay";

export default defineConfig({
  plugins: [
    createRelayPlugin({
      // Relative to the Vite root.
      artifactDirectory: "./src/__generated__",
      // Required for Vite; defaults to false in babel-plugin-relay before v21.
      eagerEsModules: true,
    }),
  ],
});

Every other option is forwarded to babel-plugin-relay unchanged.

Common Issues

Uncaught ReferenceError: global is not defined

If you experience this error in your browser console when using the plugin add the following define to your index.html file before importing your Javascript:

<script>
  let global = globalThis;
</script>

Server Side Rendering

If you are planning to use this plugin with server side rendering you may need to define window. You could do this by putting the following snippet in your entry-server.js file.

if (typeof (window as any).global === 'undefined') {
  (window as any).global = globalThis;
}

Contributing

git clone ...
pnpm i
# If you have never run Playwright run `npx playwright install` to setup your system.
cd examples/vite-3
pnpm dev

pnpm format # Do this before doing a commit

Description from the npm listing.

  • graphql
  • relay
  • typescript
  • graphql-relay
  • vite
  • vite-plugin
  • vite-plugin-relay

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-relay weekly downloads on npm, last 90 days: 67,896 weekly downloads as of Dec 5, 2026, +53.3% over 90 days.vite-plugin-relayWeekly downloads on npm · Last 90 days67,896downloads / week+53.3% over 90 days020K40K60K80K100KSep 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-relay weekly downloads on npm, last 90 days: 67,896 weekly downloads as of Dec 5, 2026, +53.3% over 90 days.

7/30/90-day growth

vite-plugin-relay weekly downloads growth on npm: -10.4% over 7 days, -18.1% over 30 days, +53.3% over 90 days.vite-plugin-relayWeekly downloads growth on npm67,896downloads / week now7-day growth-7,880 weekly downloads-10.4%30-day growth-15,030 weekly downloads-18.1%90-day growth+23,592 weekly downloads+53.3%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-relay weekly downloads growth on npm: -10.4% over 7 days, -18.1% over 30 days, +53.3% over 90 days.

Ranking history

vite-plugin-relay npm ranking history: currently #712 (by weekly downloads).vite-plugin-relaynpm ranking · by weekly downloads · Last 90 days#712current rank#640#660#680#700#720Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-relay npm ranking history: currently #712 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 36, #12 (overall #712)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins300 listings · 15 pages · page 7, #2 (overall #122)
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-relay
Date (UTC)Weekly downloadsChange vs. previous
67,896+1.1K
66,775+382
66,393-2.3K
68,703+820
67,883-2.5K
70,395-3.6K
74,034-1.7K
75,776-1.2K
76,935-6.6K
83,512-3.4K
86,899-2.3K
89,185-4K
93,161-578
93,739—

Similar npm Vite plugins plugins

All 20 vite-plugin-relay 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-relay. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.