Skip to main content
Each bundler has an entry point of its own, and each one’s default export is the plugin for it. They all take the same options.
vite.config.ts
Keep the generated files out of Vite’s build.outDir, which is dist unless you change it. When that directory sits inside the project root, vite build empties it after the plugin has compiled, and again on every vite build --watch rebuild. Write the tokens somewhere else, such as build/, or set build.emptyOutDir to false.

One configuration, several bundlers

The root entry is the unplugin instance itself. Reach for it when one options object feeds more than one bundler:
The root entry is not a way to reach a bundler with no subpath. unplugin also builds .esbuild, .farm, .rsbuild and others on it, and none of them is supported. .esbuild throws on its first build and writes nothing.

What each one rebuilds on

Every target compiles the tokens before the build that reads them. A later token change rebuilds under each target’s watch mode: A one-shot build compiles once and does not rebuild. Watching covers the rest.