nitrojs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.build
MIT License
6.16k stars 507 forks source link

feat(vercel): allow fine-grained isr config via route rules #2780

Closed pi0 closed 3 weeks ago

pi0 commented 3 weeks ago

This PR adds the ability to define isr route rule as an object:

{
  expiration?: number | false;
  group?: number;
  allowQuery?: string[];
  passQuery?: boolean;
}

Example:

export default defineNitroConfig({
  routeRules: {
    "/products/**": { isr: { allowQuery: ["q"] } },
  },
});

These route rules will be used to generate vercel prerender config

{
  "expiration": false,
  "allowQuery": [
    "q",
    "url"
  ]
}
pi0 commented 3 weeks ago

Merging to try on nightly.