{"id":16529245,"url":"https://github.com/cometkim/vite-plugin-relay-lite","last_synced_at":"2025-04-05T07:03:34.977Z","repository":{"id":45084722,"uuid":"513299233","full_name":"cometkim/vite-plugin-relay-lite","owner":"cometkim","description":"Vite plugin for more convenient Relay experience.","archived":false,"fork":false,"pushed_at":"2024-10-29T08:17:13.000Z","size":10392,"stargazers_count":43,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-29T09:35:40.012Z","etag":null,"topics":["graphql","relay","vite","vite-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cometkim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-12T21:37:28.000Z","updated_at":"2024-10-29T08:16:53.000Z","dependencies_parsed_at":"2024-02-14T16:25:04.593Z","dependency_job_id":"0fac650b-8d80-4407-a1e4-060b94f6c43c","html_url":"https://github.com/cometkim/vite-plugin-relay-lite","commit_stats":{"total_commits":194,"total_committers":7,"mean_commits":"27.714285714285715","dds":0.3608247422680413,"last_synced_commit":"4562e05adc6f68cabb327fd5bfa7762b4a472ff1"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometkim%2Fvite-plugin-relay-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometkim%2Fvite-plugin-relay-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometkim%2Fvite-plugin-relay-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometkim%2Fvite-plugin-relay-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cometkim","download_url":"https://codeload.github.com/cometkim/vite-plugin-relay-lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246940334,"owners_count":20858112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","relay","vite","vite-plugin"],"created_at":"2024-10-11T17:44:13.917Z","updated_at":"2025-04-05T07:03:34.962Z","avatar_url":"https://github.com/cometkim.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# vite-plugin-relay-lite\n\n[![Version on NPM](https://img.shields.io/npm/v/vite-plugin-relay-lite)](https://www.npmjs.com/package/vite-plugin-relay-lite)\n[![Downlaods on NPM](https://img.shields.io/npm/dm/vite-plugin-relay-lite)](https://www.npmjs.com/package/vite-plugin-relay-lite)\n[![LICENSE - MIT](https://img.shields.io/github/license/cometkim/vite-plugin-relay-lite)](#license)\n\nVite plugin for more convenient Relay experience. **With no Babel dependencies!**\n\nWhat this plugin does for you:\n- Generates artifacts on code changes\n- Transform codes without Babel plugin\n- Respects project's Relay config file\n\n\u003e [!WARNING]\n\u003e This plugin uses naive RegExp match instead of performing correct parsing for JavaScript.\n\u003e So it can fail on syntax that goes beyond the scope of a regular language. (e.g. queries in multiline comments)\n\n## Installation\n\n```bash\nyarn add -D vite graphql vite-plugin-relay-lite\n\n# Assumes the project already have relay-compiler and its configuration\n```\n\n```ts\n// vite.config.ts\n\nimport { defineConfig } from 'vite';\nimport relay from 'vite-plugin-relay-lite';\n\nexport default defineConfig({\n  plugins: [\n    relay(),\n  ],\n});\n```\n\n## Customize Options\n\n### Customize Relay Config\n\nPlugin will automatically load the Relay config file.\n\nYou can use custom config file path.\n\n```js\n{\n  plugins: [\n    relay({\n      relayConfig: 'path/to/relay.js'\n    })\n  ]\n}\n```\n\nOr pass config object.\n\n```js\n{\n  plugins: [\n    relay({\n      relayConfig: {\n        // ...relay config\n      }\n    })\n  ]\n}\n```\n\n### ES Module Output\n\nPlugin respects the `eagerEsModules` option in the Relay config, so the default output format is `commonjs`.\n\nHowever, using CommonJS in Vite projects may require additional config to transpile, and it's not recommended to use. Consider to set `eagerEsModules` to `true` in your Relay config, or set `module: 'esmodule'` in plugin options as you require.\n\n### Relay Compiler Integration\n\nPlugin automatically runs `relay-compiler` before transform, so it should be installed in the project.\n\nOr you can set the `codegen` option to `false` to disable it.\n\n```js\n{\n  plugins: [\n    relay({\n      codegen: false\n    })\n  ]\n}\n```\n\nPlugin respects the `codegenCommand` option in the Relay config, it uses `relay-compiler` if not set.\n\n### (Experimental) Omit `graphql` tag imports\n\nYou can set `omitTagImport: true` to omit import/require statements for the `graphql` tag.\n\n```js\n{\n  plugins: [\n    relay({\n      omitTagImport: true\n    })\n  ]\n}\n```\n\nThis might causes the Vite build to fail, allowing early detection of potential transform errors.\n\n## Acknowledgements\n\nThe compilation has ported from [esbuild-plugin-relay](https://github.com/smartvokat/esbuild-plugin-relay), which was originally introduced from [a gist by Samuel Cormier-Iijima](https://gist.github.com/sciyoshi/34e5865f2523848f0d60b4cdd49382ee)\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcometkim%2Fvite-plugin-relay-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcometkim%2Fvite-plugin-relay-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcometkim%2Fvite-plugin-relay-lite/lists"}