getVikeConfig()
Environment: Vite.
Get all the information Vike knows about the app in your Vite plugin.
⚠️It's a beta feature: expect breaking changes in any minor version update.
It provides all configurations set by
+
files and Vike extensions.It only provides configurations loaded at build-time. To get configurations loaded at runtime use
globalContext.config
andglobalContext.pages
instead, see API >getGlobalContext()
.
// vite.config.js
import { getVikeConfig } from 'vike/plugin'
export default {
plugins: [myVitePlugin()]
}
function myVitePlugin() {
return {
name: 'myVitePlugin',
configResolved(config) {
const vike = getVikeConfig(config)
console.log(vike.config.prerender)
console.log(vike.config.baseAssets)
console.log(vike.config.baseServer)
console.log(vike.pages['/pages/index'].config)
console.log(vike.pages['/pages/product'].route)
// ...
},
config(config) {
// Also available here
const vike = getVikeConfig(config)
}
}
}