A Vite plugin that provides a more convenient Relay experience by automatically transforming GraphQL template literals and integrating with the Relay compiler. Current stable version is 0.12.0, released with ESM defaults to match Relay Compiler v19 behavior. Supports Vite 2–7 and GraphQL 15/16. Key differentiators: lightweight, no need for .babelrc or relay-plugin, supports multiple config file formats (.config/relay.{js,json,yml}), and offers experimental features like automatic graphql tag imports. Actively maintained with frequent updates.
npm install vite-plugin-relay-liteVerified import paths — ran on the pinned version, not inferred.
Shows how to add vite-plugin-relay-lite to a Vite config with optional settings like custom config path and auto-import of graphql tag.
Use ESM import syntax (import relay from 'vite-plugin-relay-lite') instead of require().
Remove the 'compact' option from plugin config. Use default behavior.
Split multiple definitions into separate graphql tagged templates.
Upgrade Node.js to version 18 or higher.
Remove explicit import of graphql from 'relay-runtime' if autoImportGraphQLTag is true.
Ensure autoImportGraphQLTag: true is set in plugin options and that the file contains a graphql`...` expression.
Switch to ESM: use import syntax in .mjs files or set "type": "module" in package.json.
Use default import: import relay from 'vite-plugin-relay-lite'.
Create a relay.config.js file or specify a custom config path via the 'config' option.