You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-6Lines changed: 20 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,6 @@
2
2
3
3
This 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.
4
4
5
-
By default, it sets `outDir` to `.netlify/edge-functions/handler`, and generates an Edge Functions manifest that defines the `handler` function for all requests.
6
-
7
-
To 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.
8
-
9
5
# Usage
10
6
11
7
Install the plugin:
@@ -26,7 +22,25 @@ export default defineConfig({
26
22
})
27
23
```
28
24
29
-
You can disable any of these features by passing options to the `netlifyEdge()` function:
25
+
By default, it sets `outDir` to `.netlify/edge-functions/handler`, and generates an Edge Functions manifest that defines the `handler` function for all requests.
26
+
Passing 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.
This generates the file inside `.netlify/edge-functions/server`, and creates a manifest pointing to the `server` function.
38
+
39
+
### Static file handling
40
+
41
+
To 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.
42
+
43
+
You can disable any of this feature by passing options to the `netlifyEdge()` function:
30
44
31
45
```js
32
46
// vite.config.js
@@ -92,4 +106,4 @@ You can then build it using the vite CLI:
92
106
vite build --ssr handler.js
93
107
```
94
108
95
-
This will generate the Edge Function `.netlify/edge-functions/handler/index.js` and a manifest file `.netlify/edge-functions/manifest.json` that defines the `handler` function.
109
+
This 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.
0 commit comments