Skip to content

Optional catch-all [[...slug]] does not serve the root / (empty params) → 404 #3

Description

@hyf0

Problem

vinext does not serve the root / of an optional catch-all route pages/[[...slug]].js.

react.dev serves nearly everything from src/pages/[[...markdownPath]].js. Its getStaticPaths emits { markdownPath: [] } for src/content/index.md (the homepage). Under Next this serves /. Under vinext, the optional catch-all is converted to /:markdownPath* but the empty-params root is not served.

Repro

  • curl -i http://localhost:3000/404 (serves the 404 page; og:title="Not Found").
  • curl -i http://localhost:3000/_next/data/<id>/index.json → 404.
  • Every non-root path (/learn, /reference/...) → 200, so it's specific to the empty-params root.

Workaround used

Convert the optional catch-all to a required catch-all [...markdownPath].js (which no longer matches /), filter the empty entry out of getStaticPaths, add an explicit pages/index.js re-exporting default + getStaticProps, and make context.params?.markdownPath null-safe (vinext passes params === null for the static / route).

Suggested fix

An optional catch-all [[...slug]] should match / with empty params, like Next.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions