Skip to content

fix: serve prerendered pages when paths.base is set on Vercel - #17525

Draft
elliott-with-the-longest-name-on-github wants to merge 1 commit into
mainfrom
elliott/vercel-paths-base-overrides
Draft

elliott-with-the-longest-name-on-github wants to merge 1 commit into
mainfrom
elliott/vercel-paths-base-overrides

Conversation

@elliott-with-the-longest-name-on-github

Copy link
Copy Markdown
Contributor

With paths.base set, prerendered pages 404 on Vercel. Only the .html URL, e.g. /base/blog/post.html, is served.

Basically, builder.prerendered.pages records each page's file relative to base (blog/post.html), but adapter-vercel writes the files to .vercel/output/static${base}. So the file is really at base/blog/post.html. The adapter used the base-relative path as the overrides key, and overrides keys are relative to static. That means they never matched a file, and the pages were never renamed to their clean URLs.

This fixes it by adding the base to the keys. adapter-static's Vercel output doesn't have this problem, because it writes prerendered pages directly into .vercel/output/static.

The new paths-base test app only runs build tests, which check that every overrides key refers to a file that exists. Both fail without the fix. I also deployed it to confirm that /base/ and /base/prerendered/a are served and that /base/prerendered/a/ redirects.

@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
kit-ts-always Error Error Oct 22, 2026 6:24pm UTC
kit-ts-split Error Error Oct 22, 2026 6:24pm UTC

Request Review

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 6d25e5a:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/6d25e5a62176104ddc31329e9e9f0af8eec5ed2c

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17525

@changeset-bot

changeset-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6d25e5a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant