@dblechoc/vite-plugin-relay
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

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 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!

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;
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.91latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.91
1.0.80
10.0.60

Package Sidebar

Install

npm i @dblechoc/vite-plugin-relay

Weekly Downloads

1

Version

1.0.9

License

MIT

Unpacked Size

5.84 kB

Total Files

6

Last publish

Collaborators

  • dblechoc