Gathering detailed insights and metrics for vite-plugin-relay
Gathering detailed insights and metrics for vite-plugin-relay
Gathering detailed insights and metrics for vite-plugin-relay
Gathering detailed insights and metrics for vite-plugin-relay
npm install vite-plugin-relay
Typescript
Module System
Node Version
NPM Version
59.1
Supply Chain
86.4
Quality
76.9
Maintenance
100
Vulnerability
98.2
License
TypeScript (91.79%)
Shell (8.21%)
Total Downloads
1,240,502
Last Day
1,089
Last Week
18,895
Last Month
91,069
Last Year
762,087
MIT License
85 Stars
247 Commits
15 Forks
4 Watchers
9 Branches
8 Contributors
Updated on Jun 02, 2025
Minified
Minified + Gzipped
Latest Version
2.1.0
Package Id
vite-plugin-relay@2.1.0
Unpacked Size
9.39 kB
Size
3.96 kB
File Count
7
NPM Version
10.2.3
Node Version
18.19.0
Published on
Jan 28, 2024
Cumulative downloads
Total Downloads
Last Day
23.5%
1,089
Compared to previous day
Last Week
-14.6%
18,895
Compared to previous week
Last Month
8.2%
91,069
Compared to previous month
Last Year
120.8%
762,087
Compared to previous year
1
2
❤️ Special thanks to:
I do not actively use this project anymore, however, it will still receive periodic updates.
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
:
1yarn add vite-plugin-relay -D
Add vite-plugin-relay
to your Vite configuration (vite.config.ts
or vite.config.js
):
1import { defineConfig } from "vite"; 2import relay from "vite-plugin-relay"; 3 4export default defineConfig({ 5 plugins: [..., relay], 6});
Configure relay-compiler
to output artifacts with export default
syntax, by setting eagerEsModules
to true
:
1{ 2 "relay": { 3 "src": "./src", 4 "schema": "./src/schema.graphql", 5 "language": "typescript", 6 "eagerEsModules": true, 7 "exclude": ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"] 8 } 9}
Now your project is setup to use Relay with Vite!
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.
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:
1<script> 2 let global = globalThis; 3</script>
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.
1if (typeof (window as any).global === 'undefined') { 2 (window as any).global = globalThis; 3}
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
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/11 approved changesets -- score normalized to 5
Reason
8 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More