Skip to content

Config ​

kirbyup.config.js (or .ts, .mjs) in the project root configures both build and dev.

js
// 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 ​

Extra import aliases. An object maps a prefix to a replacement and applies after the built-in ~/ and @/, and your own ~/ or @/ key replaces the built-in one. An array of { find, replacement } entries allows regular expressions and applies before them. 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 ​

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.

Optionkirbyup defaultNotes
resolve.alias~/ and @/ to the entry file's folderExtend via alias
pluginsVue, Vue JSX, auto-importsYours 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.libES module from the entry fileFixed
build.outDir--out-dir, default the working directoryFixed, use --out-dir
build.rolldownOptions.external['vue']Fixed, vue comes from the Panel
build.rolldownOptions.output.codeSplittingfalseFixed, Kirby serves no script beside index.js or index.dev.js
build.minifytrue for production, false for watch buildsProduction builds also strip whitespace. 'esbuild' keeps it and needs esbuild installed. Your own build.rolldownOptions.output.minify overrides kirbyup's.
build.targetThe browsers the Kirby Panel supportsYours replaces it
server.port--port, default 5177Config wins over the flag
server.originDerived from server.host, server.https and the portThe URL written into index.dev.js
server.strictPorttrueFails instead of picking another port
server.corstrueThe 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.

vite.config.js ​

Vite loads a vite.config.js (or .ts) in the project root as well, and vite in kirbyup.config.js overrides it. Set an option kirbyup sets, such as server.port, under vite.