Build-tool integrations

Compdi must transform macro calls before they reach runtime. Choose the adapter for your build tool.

Build toolImportSetup
Vitecompdi/plugin/viteVite guide
Rollupcompdi/plugin/rollupRollup guide
Rolldowncompdi/plugin/rolldownRolldown guide
Rspackcompdi/plugin/rspackRspack guide
esbuildcompdi/plugin/esbuildesbuild guide

The default file filter includes JavaScript and TypeScript variants matching:

\.[cm]?[jt]sx?$

You can override it with the plugin's include option:

compdi({ include: /\.ts$/ })

High-resolution source maps are generated by default. Boundary mappings are available for faster production builds, or transform maps can be disabled:

compdi({ sourcemap: "boundary" })
compdi({ sourcemap: false })
If a macro throws at runtime, confirm that the adapter is registered and that the source file matches include.