项目作者: akaSybe

项目描述 :
Example of how to prerender Svelte app at build-time
高级语言: JavaScript
项目地址: git://github.com/akaSybe/svelte-prerender-example.git
创建时间: 2019-09-22T18:36:35Z
项目社区:https://github.com/akaSybe/svelte-prerender-example

开源协议:

下载


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

  1. npm install

Build

  1. npm run build

Run

  1. 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.

Remarks

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