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
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
81 Stars
247 Commits
14 Forks
4 Watching
9 Branches
8 Contributors
Updated on 18 Oct 2024
TypeScript (91.79%)
Shell (8.21%)
Cumulative downloads
Total Downloads
Last day
-10.8%
4,053
Compared to previous day
Last week
22.2%
22,653
Compared to previous week
Last month
60.2%
86,544
Compared to previous month
Last year
116.2%
518,474
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
4 existing vulnerabilities detected
Details
Reason
Found 6/11 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
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 2024-11-18
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