{"id":19904300,"url":"https://github.com/alloc/viteflare","last_synced_at":"2025-05-03T00:31:35.499Z","repository":{"id":45364434,"uuid":"438093034","full_name":"alloc/viteflare","owner":"alloc","description":"Cloudflare workers meet Vite plugins","archived":true,"fork":false,"pushed_at":"2022-01-05T16:47:45.000Z","size":176,"stargazers_count":36,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T14:57:34.522Z","etag":null,"topics":["cloudflare","vite","workers"],"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/alloc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-14T02:37:21.000Z","updated_at":"2024-11-11T17:02:36.000Z","dependencies_parsed_at":"2022-09-26T16:21:25.803Z","dependency_job_id":null,"html_url":"https://github.com/alloc/viteflare","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fviteflare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fviteflare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fviteflare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fviteflare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alloc","download_url":"https://codeload.github.com/alloc/viteflare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252126547,"owners_count":21698964,"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":["cloudflare","vite","workers"],"created_at":"2024-11-12T20:27:46.906Z","updated_at":"2025-05-03T00:31:33.635Z","avatar_url":"https://github.com/alloc.png","language":"TypeScript","funding_links":["https://paypal.me/alecdotbiz"],"categories":["TypeScript"],"sub_categories":[],"readme":"# viteflare\n\n[![npm](https://img.shields.io/npm/v/viteflare.svg)](https://www.npmjs.com/package/viteflare)\n[![Code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alecdotbiz)\n\n**ViteFlare** is a thin wrapper around Cloudflare Wrangler **v2** (which is in beta), and it brings the flexibility of Vite-powered plugins (and Vite's vibrant plugin ecosystem) to Cloudflare workers.\n\n\u0026nbsp;\n\n**What does this do?**  \nAlong with freeing your Cloudflare workers from being either contained in one file or bundled with Webpack, it allows your workers to be transformed using Vite plugins before they're deployed. It also provides a remote dev environment that exactly reproduces how Cloudflare workers operate in production.\n\n**What does this not do?**  \nIt does _not_ run Vite within your worker.\n\n\u0026nbsp;\n\n### Quick Start\n\nClone this template: [alloc/viteflare-template](https://github.com/alloc/viteflare-template)\n\nUse `degit` for a blazing fast setup locally:\n\n```sh\nnpx degit https://github.com/alloc/viteflare-template my-worker\n```\n\n### Manual Setup\n\n```sh\npnpm install viteflare vite -D\n```\n\nEach worker needs its own directory that contains a `package.json` and `wrangler.toml` file. Optionally, it can also contain a `vite.config.js` file. The `main` field in its `package.json` should point to a module that exports a Cloudflare worker.\n\n```ts\n// Example worker module\nimport { defineWorker } from 'viteflare'\n\nexport default defineWorker({\n  fetch(request, bindings, context) {\n    return Promise.resolve(new Response('hello world'))\n  },\n})\n```\n\n\u003e **Note:** `defineWorker` is only required when using TypeScript.\n\n\u0026nbsp;\n\n### Develop your worker\n\n```sh\n# In your worker's directory:\npnpm viteflare\n\n# or pass a relative path:\npnpm viteflare path/to/worker/directory\n```\n\n\u003e **Note:** You might use `yarn viteflare` instead, if you prefer.\n\nThis runs your worker **remotely**. By default, your worker listens to port 8787, but you can use `--port 1234` to change that. Currently, running multiple workers at once is not supported.\n\n#### Debugging\n\nPress `d` in the terminal while `viteflare` is running. This opens up Chrome devtools for your worker. The devtools will refresh whenever your worker is re-bundled.\n\n\u0026nbsp;\n\n### Publish your worker\n\n```sh\n# In your worker's directory:\npnpm viteflare publish\n\n# or pass a relative path:\npnpm viteflare publish path/to/worker/directory\n```\n\n\u0026nbsp;\n\n### Command forwarding\n\nEvery command supported by the `wrangler` CLI also works with the `viteflare` CLI, because ViteFlare will simply forward unimplemented commands to Wrangler v2.\n\n```sh\npnpm viteflare login\n```\n\nThis means you'll never have to install `wrangler@beta` when using ViteFlare.\n\n\u0026nbsp;\n\n### Configuration\n\nViteFlare adds convenient features to Wrangler where it sees fit, including the `wrangler.toml` configuration file. This section describes such features.\n\n#### vars.default\n\nNormally, the top-level `vars` section is **not inherited** by environments. But values within the `[vars.default]` section _will_ be inherited (ViteFlare only).\n\n```toml\n[vars]\nFOO = 123 # Not inherited by [env.production.vars]\n\n[vars.default]\nFOO = 456 # Inherited by all environments (unless overridden)\n\n[env.production.vars]\nBAR = 123\n```\n\n\u0026nbsp;\n\n### Environment variables\n\nThe following variables are recognized by ViteFlare CLI.\n\n```sh\n# Override \"account_id\" in wrangler.toml\nCF_ACCOUNT_ID=fcaf04c1e81c7db9b41b551ae7ccc949\n# Skip the Cloudflare login flow\nCF_API_TOKEN=secret\n```\n\n\u0026nbsp;\n\n## Examples\n\n- **Type-checking demo** [link](https://github.com/alloc/viteflare/tree/demo/typechecking#readme)  \n  Check for compile-time type errors with TypeScript\n\n  ![Screenshot](https://i.imgur.com/OdBBmyl.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fviteflare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falloc%2Fviteflare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fviteflare/lists"}