Skip to content

feat: skip server builds for static/SPA type apps - #16823

Draft
teemingc wants to merge 22 commits into
version-3from
skip-ssr-build
Draft

feat: skip server builds for static/SPA type apps#16823
teemingc wants to merge 22 commits into
version-3from
skip-ssr-build

Conversation

@teemingc

@teemingc teemingc commented Aug 16, 2026

Copy link
Copy Markdown
Member

closes #13217

testing

This PR spins up a Vite dev server to perform analysis and prerendering instead of coupling those processes with the SSR build so that we can skip the SSR build if it's not needed.

Why we can do this: during analysis, we're just reading file exports, it doesn't matter if they're built or not. Meanwhile, if everything is prerendered or if SSR is disabled, we have no use for the SSR build output; we build the client and feed its build output filepaths to the SSR manifest during prerendering. Doing so links to the correct client build output chunks when we save the dev server responses.

TODOS

  • make vite preview work without an SSR build
  • cleanup

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 16, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 248d7bc:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/248d7bce4781767aaf7c997b1ad02cf58e0262cb

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

@changeset-bot

changeset-bot Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 248d7bc

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Minor

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

@teemingc
teemingc marked this pull request as ready for review August 16, 2026 10:04
@teemingc
teemingc marked this pull request as draft August 16, 2026 10:04
@teemingc
teemingc marked this pull request as ready for review August 16, 2026 10:06
@teemingc
teemingc marked this pull request as draft August 16, 2026 10:06
Comment thread packages/kit/src/core/postbuild/analyse.js Outdated
teemingc and others added 3 commits August 16, 2026 18:16
@teemingc
teemingc marked this pull request as ready for review August 16, 2026 10:18
@teemingc
teemingc marked this pull request as draft August 16, 2026 10:18
@svelte-docs-bot

Copy link
Copy Markdown


let should_prerender = false;
const { manifest, server, log_response, vite_dev_server } = await (manifest_path
? get_ssr_build_server({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled this branch into mine to test cloudflare implications, this is the only thing that caused issues (it seemed to work when I swapped out this conditional to always return get_ssr_vite_server)

@teemingc teemingc Aug 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will probably need to change this later on so that it runs a Vite server with the SSR build output; similar to what I did in a previous PR. This ensures that the adapter Vite plugin stubs are run throughout prerendering

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.

optimise builds for hash router apps

2 participants