{"id":19982351,"url":"https://github.com/netlify/vite-plugin-netlify-edge","last_synced_at":"2026-03-15T16:43:25.891Z","repository":{"id":36989717,"uuid":"477991872","full_name":"netlify/vite-plugin-netlify-edge","owner":"netlify","description":"Netlify Edge Function support for Vite","archived":false,"fork":false,"pushed_at":"2025-08-15T11:10:18.000Z","size":727,"stargazers_count":22,"open_issues_count":11,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-08-18T01:43:50.991Z","etag":null,"topics":["production"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netlify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-05T05:47:49.000Z","updated_at":"2025-04-04T02:24:47.000Z","dependencies_parsed_at":"2023-10-02T01:34:55.122Z","dependency_job_id":"706db648-fe49-4b62-ab20-58c55fd044e5","html_url":"https://github.com/netlify/vite-plugin-netlify-edge","commit_stats":{"total_commits":140,"total_committers":8,"mean_commits":17.5,"dds":0.2857142857142857,"last_synced_commit":"3d0ef43d02457c6caf7f6d968a0f6d52108167e5"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/netlify/vite-plugin-netlify-edge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fvite-plugin-netlify-edge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fvite-plugin-netlify-edge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fvite-plugin-netlify-edge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fvite-plugin-netlify-edge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netlify","download_url":"https://codeload.github.com/netlify/vite-plugin-netlify-edge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fvite-plugin-netlify-edge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271385155,"owners_count":24750502,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["production"],"created_at":"2024-11-13T04:10:55.849Z","updated_at":"2026-03-15T16:43:20.856Z","avatar_url":"https://github.com/netlify.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-netlify-edge\n\nThis plugin helps add support for generating Netlify Edge Functions. This is mostly intended for frameworks that need to generate a catch-all Edge Function to serve all requests.\n\n# Usage\n\nInstall the plugin:\n\n```shell\nnpm i -D @netlify/vite-plugin-netlify-edge\n```\n\nThen add the following to your `.vite.config.js`:\n\n```js\n// vite.config.js\nimport { defineConfig } from 'vite'\nimport netlifyEdge from '@netlify/vite-plugin-netlify-edge'\n\nexport default defineConfig({\n  plugins: [netlifyEdge()],\n})\n```\n\nBy default, it sets `outDir` to `.netlify/edge-functions/handler`, and generates an Edge Functions manifest that defines the `handler` function for all requests.\nPassing a value to `functionName` will override this. This will affect the generated manifest and the base directory for the output, but it will not affect the names of the generated bundles. For this reason you should ensure that your entrypoint file is named the same as the function name.\n\n```js\n// vite.config.js\n\n// ...\nexport default defineConfig({\n  plugins: [netlifyEdge({ functionName: 'server' })],\n})\n```\n\nThis generates the file inside `.netlify/edge-functions/server`, and creates a manifest pointing to the `server` function.\n\n### Static file handling\n\nTo help with handling static files, it registers a virtual module called `@static-manifest` that exports a `Set` that includes the paths of all files in `publicDir`. This can be used in the handler to identify requests for static files.\n\nYou can disable any of this feature by passing options to the `netlifyEdge()` function:\n\n```js\n// vite.config.js\n\n// ...\nexport default defineConfig({\n  plugins: [netlifyEdge({ generateEdgeFunctionsManifest: false })],\n})\n```\n\nYou can pass additional static paths to the plugin, so that they are also included. They are paths not filenames, so should include a leading slash and be URL-encoded.\n\n```js\n// vite.config.js\nimport { defineConfig } from 'vite'\nimport netlifyEdge from '@netlify/vite-plugin-netlify-edge'\nimport glob from 'fast-glob'\n\nexport default defineConfig({\n  plugins: [\n    netlifyEdge({\n      additionalStaticPaths: glob\n        .sync('**/*.{js,css}', { cwd: 'dist/client' })\n        .map((path) =\u003e `/${encodeURI(path)}`),\n    }),\n  ],\n})\n```\n\nIf you need to add all paths under a directory then it is likely to be more efficient to check the prefix instead of adding all files individually. See the example below, where every path under `/assets/` is served from the CDN.\n\nIn order to use this plugin to create Edge Functions you must define an SSR entrypoint:\n\n```js\n// handler.js\nimport { handleRequest } from 'my-framework'\nimport staticFiles from '@static-manifest'\n\nexport const handler = async (request, { next }) =\u003e {\n  // Handle static files\n\n  const { pathname } = new URL(request.url)\n\n  // If your framework generates client assets in a subdirectory, you can add these too\n  if (staticFiles.includes(pathname) || pathname.startsWith('assets/')) {\n    return\n  }\n\n  // \"handleRequest\" is defined by your framework\n  try {\n    return await handleRequest(request)\n  } catch (err) {\n    return new Response(err.message || 'Internal Server Error', {\n      status: err.status || 500,\n    })\n  }\n}\n```\n\nYou can then build it using the vite CLI:\n\n```shell\nvite build --ssr handler.js\n```\n\nThis will generate the Edge Function `.netlify/edge-functions/handler/handler.js` and a manifest file `.netlify/edge-functions/manifest.json` that defines the `handler` function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlify%2Fvite-plugin-netlify-edge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetlify%2Fvite-plugin-netlify-edge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlify%2Fvite-plugin-netlify-edge/lists"}