sveltejs / sveltejs/kit

serve static assets from the build manifest

Open
#16,565 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-node
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

The static file server re-derives at request time what the build already computed, and each gap surfaces as its own bug:

  • MIME types: sirv bundles its own mrmime, so kit's utils/mime.js additions never reach adapter-node (#13753; patched at the response layer by #16564)
  • Vary: Accept-Encoding sent for assets that were never precompressed (#15182, #16566)
  • filenames ending in + 404 in production but resolve in dev (#11766, still reproduces on 3.0.2)
  • startup totalist walk rebuilds a lookup the build already has; ETag is mtime-derived, not content-derived
Describe the proposed solution

Record the two things adapt time knows and currently discards (which files builder.compress produced variants for, and a content hash), then serve from the manifest: lookup and stream. Type from manifest.mimeTypes, Vary only where a variant exists, exact keys instead of path-guessing, no startup walk. sirv, totalist, @polka/url and mrmime drop out of adapter-node as a consequence. Exporting the server from @sveltejs/kit/node keeps adapter-node on one copy.

Alternatives considered

Upstreaming: sirv#173 open unreviewed since January, last release September 2025. Vendoring sirv's 249 lines as-is: fixes MIME but keeps the runtime re-derivation.

Importance

nice to have

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the adapter-node static serving path and the manifest data produced by builder.compress. Trace which compression variants and content hash are currently discarded, then review the proposed server export from @sveltejs/kit/node. Done means serving uses manifest lookups and streams, with correct MIME types, conditional Vary headers, exact filenames, and no startup walk.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, web-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.