prerender()
You can programmatically trigger pre-rendering:
Use API >
prerender
>disableAutoRun
to avoid pre-rendering to be run twice.
pageContextInit
The initial value of each page's pageContext
object.
viteConfig
The Vite config.
It's optional: if omitted, Vite automatically loads vite.config.js
.
We recommend to either omit this option or set it to prerender({ viteConfig: { root }})
: the vite.config.js
file living at root
will be loaded.
Alternatively you can:
- Set:
- Not load any
vite.config.js
file and, instead, useprerender({ viteConfig: { configFile: false, ...myViteConfig }})
to programmatically define the entire Vite config.
You can also load a vite.config.js
file while overriding parts of the Vite config.
See Vite > JavaScript API > InlineConfig
.
onPagePrerender()
⚠️Don't use this option without having contacted a Vike maintainer: this functionality may be changed/removed at any time if you don't.
The onPagePrerender
option allows you to control where/how HTML files are written.
More settings
For more settings, see API > prerender
.