Config
kirbyup.config.js in the project root configures both build and dev. The file is loaded with c12, so .ts, .mjs and .js all work. Neither .kirbyuprc nor a package.json key is read.
// kirbyup.config.js
import { defineConfig } from 'kirbyup/config'
export default defineConfig({
alias: {},
vite: {},
})defineConfig(config)
Returns config unchanged. It exists for type hints and autocompletion.
alias
- Type:
AliasOptionsfrom Vite
Extra import aliases, merged after the built-in ~/ and @/. An object maps a prefix to a replacement, an array of { find, replacement } entries allows regular expressions. Entries apply in order, the first match wins.
Absolute paths resolve on the file system. Relative values are passed through as written, which is rarely what you want.
vite
- Type:
InlineConfigfrom Vite
Merged into kirbyup's own config with Vite's mergeConfig. Arrays such as plugins are appended, everything else overrides.
kirbyup sets these options. Overriding the ones marked as fixed breaks the output.
| Option | kirbyup default | Notes |
|---|---|---|
resolve.alias | ~/ and @/ to the entry file's folder | Extend via alias |
plugins | Vue, Vue JSX, auto-imports | Yours are appended. Vue and Vue JSX treat the Panel's k-validator and k-input-validator as custom elements. |
envPrefix | ['VITE_', 'KIRBYUP_'] | See Env Variables |
build.lib | ES module from the entry file | Fixed |
build.rolldownOptions.external | ['vue'] | Fixed, vue comes from the Panel |
build.rolldownOptions.output.codeSplitting | false | Fixed, Kirby serves no script beside index.js or index.dev.js |
build.minify | true for production, false for watch builds | With Vite's own minifier, kirbyup also sets build.rolldownOptions.output.minify, which Vite's library mode leaves without whitespace removal. Set it yourself to override. 'esbuild' keeps the whitespace. |
build.target | The browsers the Kirby Panel supports | Yours replaces it |
server.port | --port, default 5177 | Config wins over the flag |
server.origin | Derived from server.host, server.https and the port | The URL written into index.dev.js |
server.strictPort | true | Fails instead of picking another port |
server.cors | true | The Panel runs on another origin |
Set server.origin when the Panel cannot reach the dev server under the derived URL, for example on another host or behind a proxy.