Skip to content

Add the `prefixes` option to skip filesystem lookups for application routes

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 08:47
· 4 commits to 2.x since this release
Immutable release. Only release title and notes can be modified.

2.0.2 (2026-11-24)

Performance Improvements

  • Add the prefixes option. When it is set, the static middleware looks for a file in public/ only for the requests whose path is a prefix or is under one, and sends each other request to your routes with no filesystem lookup. Prefixes are compared with the decoded path, and a file outside them is not served. Without the option, nothing changes. (#11), closes #2

    // config/static.ts
    export default defineConfig({
      prefixes: ['/assets', '/favicon.ico', '/robots.txt'],
    })

Full Changelog: v2.0.1...v2.0.2