All Projects → oscartbeaumont → vite-plugin-relay

oscartbeaumont / vite-plugin-relay

Licence: MIT License
A vite plugin for Relay

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to vite-plugin-relay

vite-plugin-dts
A vite plugin for generating `.d.ts` files.
Stars: ✭ 539 (+1125%)
Mutual labels:  vite, vite-plugin
vite-plugin-banner
A banner plugin for Vite. It can adds a banner to the top of each generated chunk.
Stars: ✭ 39 (-11.36%)
Mutual labels:  vite, vite-plugin
vite-plugin-radar
All in one analytics loader for vite
Stars: ✭ 64 (+45.45%)
Mutual labels:  vite, vite-plugin
Parse Server
API server module for Node/Express
Stars: ✭ 19,165 (+43456.82%)
Mutual labels:  relay, graphql-relay
vite-plugin-checker
💬 Vite plugin that provide checks of TypeScript, ESLint, vue-tsc, and more.
Stars: ✭ 338 (+668.18%)
Mutual labels:  vite, vite-plugin
vite-plugin-html-template
html template for vite, like html-webpack-plugin for webpack.
Stars: ✭ 97 (+120.45%)
Mutual labels:  vite, vite-plugin
vite-plugin-ssr
Like Next.js / Nuxt but as do-one-thing-do-it-well Vite plugin.
Stars: ✭ 1,703 (+3770.45%)
Mutual labels:  vite, vite-plugin
vite-plugins
🌱 为社区尽一份绵薄之力
Stars: ✭ 63 (+43.18%)
Mutual labels:  vite, vite-plugin
vite-plugin-environment
Easily expose environment variables in Vite.js
Stars: ✭ 57 (+29.55%)
Mutual labels:  vite, vite-plugin
vite-plugin-sleep
a vite plugin you never need. slow devServer and slow HMR.
Stars: ✭ 77 (+75%)
Mutual labels:  vite, vite-plugin
vite-plugin-env-compatible
Environment Variables Compatible for vite(with vue-cli, create-react-app and so on)
Stars: ✭ 35 (-20.45%)
Mutual labels:  vite, vite-plugin
vite-plugin-inspect
Inspect the intermediate state of Vite plugins
Stars: ✭ 491 (+1015.91%)
Mutual labels:  vite, vite-plugin
vite-plugin-md
Markdown with Vue for Vite
Stars: ✭ 289 (+556.82%)
Mutual labels:  vite, vite-plugin
vite-plugin-restart
Custom files/globs to restart Vite server
Stars: ✭ 92 (+109.09%)
Mutual labels:  vite, vite-plugin
vite-plugin-webfont-dl
⚡ Webfont Download Vite Plugin - Make your Vite site load faster
Stars: ✭ 69 (+56.82%)
Mutual labels:  vite, vite-plugin
vite-plugin-compress
Compress your bundle + assets from Vite
Stars: ✭ 103 (+134.09%)
Mutual labels:  vite, vite-plugin
fast-relay-pagination
Improve relay pagination performance with find and limit
Stars: ✭ 18 (-59.09%)
Mutual labels:  relay, graphql-relay
vite-analysis
出最新版本的全部源码分析中...(换了m1芯片arm64架构的电脑,旧版本无法运行,如esbuild Chromium)
Stars: ✭ 138 (+213.64%)
Mutual labels:  vite
postfix-relay
Postfix SMTP relay docker image
Stars: ✭ 76 (+72.73%)
Mutual labels:  relay
react-relay-pokemon
Use React & Relay as your Pokedex!
Stars: ✭ 88 (+100%)
Mutual labels:  relay

Vite Plugin Relay

NPM CI workflow

Add relay support to your Vite projects.

Created with the help of @Brendonovich and thanks to @kesne for adding pnpm support.

Usage

Add vite-plugin-relay and relay to your project.

yarn add react-relay relay-runtime
yarn add -D relay-compiler relay-config vite-plugin-relay

Next setup NPM scripts in the package.json. One is required for Vite and the other for the Relay Compiler

"scripts": {
  "dev": "vite",
  "relay": "relay-compiler"
},

Next setup relay.config.js more information about this can be found in the official relay docs.

Finally add vite-plugin-relay to your Vite configuration (vite.config.ts).

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

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

Now your project is setup to use Relay with Vite!

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;
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].