Skip to content
Officialv5.6.0MITkubb >=5.0.0node >=22

@kubb/plugin-barrel

Generates an index.ts barrel for every plugin output and one root barrel, so you import all generated code from a single entry point. Ships with Kubb, but only generates barrels once output.barrel is configured.

barrelindexexportsoutput
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
173.7K/ mo
Stars
1.8K
Bundle size
113.4 kB
Updated
6h ago

Generate index.ts exports for plugin outputs and the root entry point.

  • Runs automatically with Kubb.
  • Configure exports through output.barrel.

Installation

Ships with kubb, no extra install.

Dependencies

  • No plugin dependencies.
  • defineConfig adds it to plugins for you. Do not add it yourself.

Example

Set output.barrel on the root configuration to enable a root barrel and the default inherited by plugins without their own barrel setting.

kubb.config.ts
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()],
})

See options for the export type, nested barrels, and per-plugin overrides.