0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00
astro/.changeset/tiny-gifts-drum.md
Slawek Kolodziej 7ea0aba053
feat(vercel): allow defining ISR exclusions with regular expressions (#13211)
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>


Co-authored-by: ematipico <602478+ematipico@users.noreply.github.com>
Co-authored-by: sarah11918 <5098874+sarah11918@users.noreply.github.com>
2025-02-26 10:30:22 +00:00

896 B

@astrojs/vercel
minor

Adds support for regular expressions in ISR exclude list

Previously, excluding a page from ISR required explicitly listing it in isr.exclude. As websites grew larger, maintaining this list became increasingly difficult, especially for multiple API routes and pages that needed server-side rendering.

To address this, ISR exclusions now support regular expressions, allowing for more flexible and scalable configurations.

// astro.config.mjs
import vercel from '@astrojs/vercel/serverless';

export default defineConfig({
  output: 'server',
  adapter: vercel({
    isr: {
      exclude: [
        '/preview',      // Excludes a specific route (e.g., pages/preview.astro)
        '/auth/[page]',  // Excludes a dynamic route (e.g., pages/auth/[page].astro)
        /^\/api\/.+/,    // Excludes all routes starting with /api/
      ]
    }
  })
});