add more docs about pre-rendering

This commit is contained in:
Leo McArdle 2022-04-13 16:01:08 +01:00 коммит произвёл Tasos Katsoulas
Родитель 891a86eb05
Коммит e16c4fef0e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 522F81314743785E
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -55,3 +55,26 @@ First the components must pass through the Svelte compiler,
with the appropriate flags enabled to compile components for server-side rendering (SSR).
Then those compiled components must be rendered into static HTML.
We do both these steps in Webpack using the `webpack.pre-render.js` config file.
In order to pre-render a route,
add it to the config object passed to `svelte-pre-render-plugin` in `webpack.pre-render.js`,
referencing the entrypoint containing the component you want to render:
```
entry: {
foobar: "./svelte/SomeComponent",
barfoo: "./svelte/AnotherComponent",
},
plugins: [
new SveltePreRenderPlugin({
"foobar.js": [
"/route-1",
"/route-2",
"/route-2/subroute",
],
"barfoo.js": [
"/route-3",
],
}),
],
```