From 8fae077cbca4a772af0bf18363cdc13851fd7892 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Thu, 25 Apr 2019 23:51:28 +0200 Subject: [PATCH] Add section on Server Side Rendering Added a quick example on how to enable SSR in svelte-loader since documentation was missing this. It should ideally say what all values of `generate` do and how they work but `ssr` is the first value I stumbled upon. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index be9452b2..fa3737bb 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,22 @@ Or, on a global basis by adding `{noPreserveState: true}` to `hotOptions`. For e } ``` +#### Server Side Rendering #### + +If you want to use Server Side Rendering (SSR), you'll need to set the `generate` option to `'ssr'`. +```js + { + test: /\.(html|svelte)$/, + exclude: /(node_modules)/, + use: { + loader: 'svelte-loader', + options: { + generate: 'ssr', + } + } + } +``` + **Please Note:** If you are using `svelte/store`, `noPreserveState` has no effect on `store` properties. Neither locally, nor globally. #### External Dependencies