Registry / http-networking / unplugin-kubb

unplugin-kubb

JSON →
library5.0.16jsnpmunverified

Universal build plugin for Kubb that integrates OpenAPI code generation into Vite, Webpack, Rollup, esbuild, Rspack, Nuxt, and Astro build processes. Current stable version is 5.0.16, with alpha releases signaling active development. It ships TypeScript types and requires Node >=20. Key differentiators: multi-bundler support via unplugin, seamless integration with modern build tools, and automatic code generation from OpenAPI specs.

npm install unplugin-kubb
INSTALL
IMPORT
SIG · UNPLUGIN-KUBB
U
unplugin-kubb
http-networkingjavascriptv5.0.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KubbPlugin
import { KubbPlugin } from 'unplugin-kubb'
const { KubbPlugin } = require('unplugin-kubb')
ESM-only since v5; requires Node>=20. Named export.
default
import KubbPlugin from 'unplugin-kubb'
const KubbPlugin = require('unplugin-kubb')
Default export alias for KubbPlugin. Same as named export.
type KubbPluginOptions
import type { KubbPluginOptions } from 'unplugin-kubb'
Type export for TypeScript users.
createKubbPlugin
import { createKubbPlugin } from 'unplugin-kubb'
import { CreateKubbPlugin } from 'unplugin-kubb'
Factory function; not a class. Lowercase 'c'.

Shows how to integrate Kubb into a Vite project using the unplugin-kubb plugin with an OpenAPI spec.

import { defineConfig } from 'vite'; import KubbPlugin from 'unplugin-kubb'; export default defineConfig({ plugins: [ KubbPlugin({ input: { path: './openapi.yaml', }, output: { path: './src/generated', }, // Optional: specify additional plugins plugins: ['@kubb/swagger-ts', '@kubb/swagger-client'], }), ], });
Debug
Known issues
breakingESM-only since v5: CommonJS require() not supported.
fix
Switch to ESM imports and set `"type": "module"` in package.json.
affects: >=5.0.0
breakingMinimum Node version raised to 20 in v5.
fix
Upgrade Node.js to >=20.
affects: >=5.0.0
gotchaPlugin must be placed before other plugins that transform output files.
fix
Place KubbPlugin early in the plugins array to ensure generated files are available.
affects: *
gotchaDependency on @kubb/core version ^4.0.0 may cause peer dependency conflicts if using Kubb v5 alpha.
fix
Ensure all Kubb packages are on the same version range.
affects: 5.0.0-alpha.x
deprecatedThe `input` option `path` is deprecated in favor of `input.url` in v5 alpha.
fix
Use `input.url` instead of `input.path`.
affects: >=5.0.0-alpha.70
Errors
Common errors & fixes
Cannot find module 'unplugin-kubb' or its corresponding type declarations.
Package not installed or missing TypeScript declaration.
fix
Run `npm install unplugin-kubb @kubb/core` and ensure tsconfig includes node_modules.
TypeError: KubbPlugin is not a function
Using default import with require() or wrong import statement.
fix
Use `import KubbPlugin from 'unplugin-kubb'` (ESM).
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
CommonJS require() used with ESM-only package.
fix
Switch to `import` syntax or use dynamic import().
Uncaught TypeError: Cannot read properties of undefined (reading 'path')
Missing or incorrectly configured `input` option.
fix
Provide `input` object with `path` or `url` property.
Upgrade
Version history
5.0.16latest on npm
Audit
Dependencies
@kubb/corerequiredCore Kubb library for code generation logic
viteoptionalRequired for Vite integration
rollupoptionalRequired for Rollup integration
esbuildoptionalRequired for esbuild integration
webpackoptionalRequired for Webpack integration
@nuxt/kitoptionalRequired for Nuxt integration
@farmfe/coreoptionalRequired for Farm integration
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
unplugin-kubb — npm install unplugin-kubb · libregistry