SvelteKit 2.70 · Svelte 5.57

Lazy-load your CMS sections. Keep every one in the HTML.

I measured five ways to lazy-load CMS sections in SvelteKit. Two leave sections out of the server HTML. One makes every page download code it never uses. One puts every section in the HTML and ships only the code each page needs.

Sections in the server HTML

Universal load (+page.ts)
5 / 5
Static imports
5 / 5
Svelte async await (experimental)
5 / 5
{#await import()} in the template
2 / 5
onMount
2 / 5
view-source of one page · production build · 27 Sep 2026
The problem

It works on screen. Then you open View Source.

Your page is a list of typed sections from a CMS. You lazy-load them to keep the bundle small. The page looks right. But the HTML the server sent has "Loading…" placeholders where the gallery should be, and that HTML is what link previews, bots and your users' first paint get.

Measured on a production build · 27 Sep 2026

Five strategies, one page

StrategySections in server HTMLSection code a small page downloads
{#await import()} in the template2 / 5only what it uses
onMount2 / 5only what it uses
Static imports of every section5 / 5every section, on every page
Universal load (+page.ts) + registry5 / 5only what it uses
Svelte async await (experimental)5 / 5only what it uses
500

One bad CMS entry takes the page down

A Gallery with an empty images array turned the whole page into a 500, even with <svelte:boundary> around every section: during SSR it didn't catch the error (Svelte 5.57). I had expected the opposite. Validation in the server load fixes it.

~1.5 s

The whole page waits

With lazy section code slowed by 1.5 s (simulated), nothing on the page hydrated until it arrived. That is true for every strategy that renders the section on the server, static imports included.

1 command

Check your own app

One curl command tells you whether a lazy section is in your server HTML, with one trap: SvelteKit's serialized page data contains the text too. The guide shows the command that avoids it.

Measured Rules · 7 rules, 10 passing tests

Your AI assistant gets it right the first time

Your assistant keeps writing the code. The rules tell it which pattern to use and why, in the format it reads: a Claude skill, a Cursor rule, Copilot instructions or AGENTS.md. Every rule names the test that backs it.

  1. 01 Resolve lazy section components in the universal load, never in the template. free
  2. 02 Never put content behind {#await import()} or onMount. free
  3. 03 Keep a small core map; load everything else through import.meta.glob. in the pack
  4. 04 Unknown section types render nothing. Never build an import path from CMS data. in the pack
  5. 05 Validate CMS section data in the server load and drop invalid sections. in the pack
  6. 06 Treat <svelte:boundary> as client-side protection only. in the pack
  7. 07 Know what happens when a lazy chunk fails in the browser. in the pack

Rules 1 and 2 are free in the demo README. The pack adds the rest, templates, an audit prompt, a PR checklist and the tests to run in your own repo.

What you get

The guide, the rules and the tests

Guide cover: Lazy CMS Sections with Full SSRGuide page: chapter 1, Where the import runs decides your HTML
Guide 01, draft PDF · 16 pages, 3 chapters
  • Chapter 1: where the import runs decides your HTML. Five strategies, measured.
  • Chapter 2: one bad CMS entry. Validation and failure modes.
  • Chapter 3: what it costs, and how to check your app.
Planned pricing

Pick what you need

Guide

€19 PDF

Base price (bazna cijena) on 16.10.2026: €19

  • The full guide (3 chapters)
  • Every measurement with versions and scripts
  • Free updates to this edition
Join the waitlist

Team

€199 up to 10 developers

Base price (bazna cijena) on 16.10.2026: €199

  • Everything in Guide + Measured Rules
  • Licence for up to 10 developers of one company
  • Commit the rules to all of your company's repos
Join the waitlist

Planned prices. Sales open soon. The waitlist hears first. Season 1 bundle: all four topics, Guide + Measured Rules for €99 (base price (bazna cijena) on 16.10.2026: €99), or any three topics for the price of two. Prices in euro, VAT included. Payment goes through Paddle, the merchant of record; a business can enter its VAT ID at checkout, and reverse charge then applies where the law allows.

Free now · guides soon

Get the section renderer checklist

One page per topic, every check backed by a measurement: section renderer, ssr state, sveltekit defaults and big lists in svelte 5 state.

  1. 1Enter your email. You land on our mailing-list page.
  2. 2Open the confirmation email from hello@measuredfrontend.com and click the link.
  3. 3The confirmation page lists the four PDFs. About one minute in total.

After that: one email when the guides open, and a short note when a new measurement is published. Unsubscribe in one click. No confirmation, no emails: the address is deleted within 30 days.

Double opt-in: nothing is sent until you click the link in that email.

FAQ

Questions

Why not just ask my AI assistant?

A lazy import inside the template, with {#await import()} or in onMount, is a common way to lazy-load a component, and it looks right on screen. I haven't measured how often assistants write it. I measured what it does: 2 of 5 sections in the server HTML. The pack tells your assistant where the import belongs, and the drop-in tests check your pages.

Is the code free?

Yes. The demo, the measurements and the demo's tests are MIT. You pay for the explanation, the edge cases and the ready-to-use rules.

Googlebot runs JavaScript. Why care about the HTML?

Link previews and many bots don't run JavaScript, and your users still see sections pop in after hydration. Complete HTML also means a complete first paint.

Which versions was this tested on?

SvelteKit 2.70, Svelte 5.57, Vite 8.3, on 27 Sep 2026. Each update says what was re-tested and on which versions.

When can I buy it?

Sales open soon. The waitlist hears first: one email when it opens, and the free section renderer checklist right after you confirm.