vite-plugin-vercel 8.0.1 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -8
- package/dist/index.cjs +359 -385
- package/dist/index.d.cts +50 -39
- package/dist/index.d.ts +50 -39
- package/dist/index.js +357 -383
- package/index.d.ts +4 -4
- package/package.json +10 -13
package/README.md
CHANGED
|
@@ -97,17 +97,13 @@ export default async function handler() {
|
|
|
97
97
|
|
|
98
98
|
You can use [Edge middleware as describe in the official documentation](https://vercel.com/docs/functions/edge-middleware/middleware-api) (i.e. with a `middleware.ts` file at the root of your project).
|
|
99
99
|
|
|
100
|
-
## Usage with
|
|
100
|
+
## Usage with Vike
|
|
101
101
|
|
|
102
|
-
[
|
|
102
|
+
[Vike](https://vike.dev/) is supported through [@vite-plugin-vercel/vike](/packages/vike-integration/README.md) plugin.
|
|
103
103
|
|
|
104
104
|
You only need to install `@vite-plugin-vercel/vike`, the Vite config stays the same as above.
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
> `@vite-plugin-vercel/vike` supersedes the old `@magne4000/vite-plugin-vercel-ssr` package.
|
|
108
|
-
> As such, you should remove `@magne4000/vite-plugin-vercel-ssr` from your package.json and vite config file.
|
|
109
|
-
|
|
110
|
-
You can then leverage [config files](https://vike.dev/config) to customize ISR configuration:
|
|
106
|
+
You can then leverage [config files](https://vike.dev/config) to customize your endpoints:
|
|
111
107
|
|
|
112
108
|
```ts
|
|
113
109
|
// /pages/product/+config.ts
|
|
@@ -115,9 +111,15 @@ You can then leverage [config files](https://vike.dev/config) to customize ISR c
|
|
|
115
111
|
import Page from './Page';
|
|
116
112
|
import type { Config } from 'vike/types';
|
|
117
113
|
|
|
118
|
-
// Customize ISR config for this page
|
|
119
114
|
export default {
|
|
115
|
+
// Customize ISR config for this page
|
|
120
116
|
isr: { expiration: 15 },
|
|
117
|
+
// Target Edge instead of Serverless
|
|
118
|
+
edge: true,
|
|
119
|
+
// append headers to all responses
|
|
120
|
+
headers: {
|
|
121
|
+
'X-Header': 'value'
|
|
122
|
+
}
|
|
121
123
|
} satisfies Config;
|
|
122
124
|
```
|
|
123
125
|
|
|
@@ -172,6 +174,20 @@ export default defineConfig({
|
|
|
172
174
|
* See https://vercel.com/docs/projects/project-configuration#rewrites
|
|
173
175
|
*/
|
|
174
176
|
rewrites: [{ source: '/about', destination: '/about-our-company.html' }],
|
|
177
|
+
/**
|
|
178
|
+
* @see {@link https://vercel.com/docs/projects/project-configuration#headers}
|
|
179
|
+
*/
|
|
180
|
+
headers: [
|
|
181
|
+
{
|
|
182
|
+
"source": "/service-worker.js",
|
|
183
|
+
"headers": [
|
|
184
|
+
{
|
|
185
|
+
"key": "Cache-Control",
|
|
186
|
+
"value": "public, max-age=0, must-revalidate"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
],
|
|
175
191
|
/**
|
|
176
192
|
* See https://vercel.com/docs/projects/project-configuration#redirects
|
|
177
193
|
*/
|