Prerender Svelte app at build-time

:warning: I'd recommend you to use rollup-plugin-svelte-ssr instead. It uses the same approach but it's easier to use.

This is an example how to prerender Svelte app

Get started

Install the dependencies

npm install


npm run build


npm run serve

Navigate to localhost:5000. You should see your app running

How it works

Rollup config consists of two separate configs:

The first config used to build usual iife bundle with app.

The second config used to build root component as SSR component. When SSR component bundled, Rollup executes script prerender.js, which uses SSR Component API to get HTML and CSS.


It's experimental example. Maybe there is a more simple way.

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes