Bundler Plugins
Build-time Cookbook Router generation for Vite, Webpack, Rspack, Rollup, esbuild, and Bun.
The job
The plugins run Cookbook Router generation before application modules are compiled. That is the whole promise. The consuming code sees real files, not a virtual-module trick that works until another tool touches the graph.
Choose a plugin
Pick by bundler and watch requirements.
Shared options
Understand precedence, generated files, and the common runner.
Watch and recovery
Know exactly what recovers after a broken route or config.
Troubleshooting
Fix generation and watch failures without ritual sacrifice.
Supported packages
| Bundler | Package | Public constructor |
|---|---|---|
| Vite | @cookbook/router-vite-plugin | cookbookRouterVitePlugin() |
| Webpack | @cookbook/router-webpack-plugin | new CookbookRouterPlugin() |
| Rspack | @cookbook/router-rspack-plugin | new CookbookRouterRspackPlugin() |
| Rollup and Rolldown | @cookbook/router-rollup-plugin | cookbookRouterRollupPlugin() |
| esbuild | @cookbook/router-esbuild-plugin | cookbookRouterEsbuildPlugin() |
| Bun | @cookbook/router-bun-plugin | cookbookRouterBunPlugin() |
Vite exports only the named factory. Webpack, Rspack, Rollup, esbuild, and Bun also expose a default export. Rspack additionally exports CookbookRouterPlugin as an alias of CookbookRouterRspackPlugin.