lunx.docs
DocsGuidesBuild Cache

Build Cache

lunx build skips work it has already done: an unchanged project is not rebuilt, and framework components that did not change are not recompiled.

New in 1.1.0
Unchanged project: no build

About 150 ms instead of 700 ms on a 2,000-component React app.

Per-file compile cache

1,000 Vue components: 3.5 s cold, 0.7 s with the cache, 1 s after editing one.

Same output

Cached and uncached builds produce byte-identical files.

How it decides

The cache lives in .lunx/ (add it to .gitignore). A build is reused only when all of these match the last one:

  • every project file outside node_modules and the output directory (modification time and size)
  • the package manager's install record, so installing or upgrading a package rebuilds
  • the CLI options and the env vars that become defines (NODE_ENV, LUNX_*, VITE_*, PUBLIC_*, REACT_APP_*)
  • the lunx version, and the output directory being untouched

Compiled Vue, Svelte, Solid and JSX output is keyed by the source, the compiler versions and their config files (svelte.config.*, tsconfig.json, Babel config).

Controls

FieldTypeDefaultDescription
lunx build --forceCLI—Rebuild now; the result is still recorded for next time.
LUNX_BUILD_CACHE=0env—Skip both caches for this build.
build: { cache: false }lunx.config—Turn the cache off for the project.
LUNX_TIMINGS=1env—Print how long each build phase takes.
bash
$ npx lunx build
  ✓ Up to date: nothing changed since the last build. Use --force to rebuild.
Projects with more than 25,000 files
Above that, checking every file costs more than it saves, so the whole-build check is skipped. The per-file compile cache still applies.