⚠️ 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
Install the dependencies
npm install
Build
npm run build
Run
npm run serve
Navigate to localhost:5000. You should see your app running
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.