Skip to content

Missing .html file extension when prerendering on Vercel #13822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrei-livadariu opened this issue May 25, 2025 · 0 comments
Open

Missing .html file extension when prerendering on Vercel #13822

andrei-livadariu opened this issue May 25, 2025 · 0 comments

Comments

@andrei-livadariu
Copy link

Describe the bug

When using the static adapter and prerendering the entire site, building on my local machine generates files with the .html extension for every route. Building on Vercel, however, only index.html has the .html extension. The other routes are missing an extension.

Vercel manages to resolve requests to those files even without the extension. However, the issue is with a 404 error handling route. To deal with invalid routes on a fully prerendered site, you need to provide a 404.html file for Vercel to use as a handler. Vercel needs 404.html with that exact name, so without the extension it doesn't work.

Furthermore, if you try to rename the route folders to contain the .html extension, then Vercel doesn't build them at all.

Reproduction

  1. Fresh SvelteKit install with @sveltejs/adapter-static.
  2. Set up the following routes:
/routes/+page.svelte
/routes/test/+page.svelte
/routes/404/+page.svelte
  1. Create /routes/+layout.server.ts with the content export const prerender = true;.
  2. Run build

When building on my local machine, the result is:

index.html
test.html
404.html

When building on Vercel, the result is:

index.html
test
404

The expected result is the same as the local build, so the issue is that the .html extensions are missing.

Now rename the paths to get the following project structure:

/routes/+page.svelte
/routes/test.html/+page.svelte
/routes/404.html/+page.svelte

When building locally, the result is the same as before.
When building on Vercel, the result is:

index.html

The other routes are missing entirely.

Logs

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 1.89 GB / 15.71 GB
  Binaries:
    Node: 20.15.1 - C:\laragon\bin\nodejs\node-v20.15.1-win-x64\node.EXE
    npm: 10.7.0 - C:\laragon\bin\nodejs\node-v20.15.1-win-x64\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.86)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @sveltejs/adapter-static: ^3.0.8 => 3.0.8
    @sveltejs/kit: ^2.21.1 => 2.21.1
    @sveltejs/vite-plugin-svelte: ^5.0.3 => 5.0.3
    svelte: ^5.33.2 => 5.33.2
    vite: ^6.3.5 => 6.3.5

Severity

annoyance

Additional Information

No response

@andrei-livadariu andrei-livadariu changed the title Missing .html file extension when prerendering on Verecel Missing .html file extension when prerendering on Vercel May 25, 2025
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

No branches or pull requests

1 participant