plugins: [pluginBarrel()]Barrel
@kubb/plugin-barrel
Generates index.ts barrel files for every plugin output and one root barrel.
- Downloads173.5K/ monthnpm, last 30 days
- GitHub stars1.8Kkubb-labs/kubb
- Unpacked size115.3kBv5.8.3 on npm
- Latest release2h agov5.8.3 · Oct 13, 2026
The barrel plugin writes index.ts files that re-export generated code, one for each plugin's output and one root barrel, so you can import everything from a single entry point.
Kubb adds it to plugins for you. Do not add it yourself. It generates nothing until you configure output.barrel.
Installation
bun add -d @kubb/plugin-barrelpnpm add -D @kubb/plugin-barrelnpm install --save-dev @kubb/plugin-barrelyarn add -D @kubb/plugin-barrelOr run kubb add plugin-barrel to install the version the Kubb registry pins and add pluginBarrel() to kubb.config.ts.
Setup
Set output.barrel on defineConfig to write a root barrel. Plugins without a barrel setting of their own inherit it.
Options
The plugin takes no arguments. You configure it through output.barrel, on defineConfig or on a single plugin.
type: 'named're-exports each symbol by name, which suits tree-shaking.type: 'all'writesexport *.nested: true, on a plugin only, makes each barrel re-export just its own directory and the barrels below it. The root barrel is always flat.falseon a plugin turns its barrel off and leaves its files out of the root barrel.
A plugin with output.mode: 'file' gets no barrel of its own. The root barrel re-exports that file directly. Passing your own output object to a plugin replaces its default barrel: { type: 'named' }, so it falls back to the root setting.
See Options for the export type, nested barrels, and per-plugin overrides.
Example
import { defineConfig } from 'kubb/config'
import { pluginTs } from '@kubb/plugin-ts'
export default defineConfig({
input: './petStore.yaml',
output: { path: './src/gen', barrel: { type: 'named' } },
plugins: [pluginTs()],
})Dependencies
No extension dependencies.