{"id":27505,"library":"unplugin-kubb","title":"unplugin-kubb","description":"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.","status":"active","version":"5.0.16","language":"javascript","source_language":"en","source_url":"https://github.com/kubb-labs/kubb","tags":["javascript","unplugin","vite","webpack","rollup","esbuild","rspack","nuxt","astro","typescript"],"install":[{"cmd":"npm install unplugin-kubb","lang":"bash","label":"npm"},{"cmd":"yarn add unplugin-kubb","lang":"bash","label":"yarn"},{"cmd":"pnpm add unplugin-kubb","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Kubb library for code generation logic","package":"@kubb/core","optional":false},{"reason":"Required for Vite integration","package":"vite","optional":true},{"reason":"Required for Rollup integration","package":"rollup","optional":true},{"reason":"Required for esbuild integration","package":"esbuild","optional":true},{"reason":"Required for Webpack integration","package":"webpack","optional":true},{"reason":"Required for Nuxt integration","package":"@nuxt/kit","optional":true},{"reason":"Required for Farm integration","package":"@farmfe/core","optional":true}],"imports":[{"note":"ESM-only since v5; requires Node>=20. Named export.","wrong":"const { KubbPlugin } = require('unplugin-kubb')","symbol":"KubbPlugin","correct":"import { KubbPlugin } from 'unplugin-kubb'"},{"note":"Default export alias for KubbPlugin. Same as named export.","wrong":"const KubbPlugin = require('unplugin-kubb')","symbol":"default","correct":"import KubbPlugin from 'unplugin-kubb'"},{"note":"Type export for TypeScript users.","symbol":"type KubbPluginOptions","correct":"import type { KubbPluginOptions } from 'unplugin-kubb'"},{"note":"Factory function; not a class. Lowercase 'c'.","wrong":"import { CreateKubbPlugin } from 'unplugin-kubb'","symbol":"createKubbPlugin","correct":"import { createKubbPlugin } from 'unplugin-kubb'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport KubbPlugin from 'unplugin-kubb';\n\nexport default defineConfig({\n  plugins: [\n    KubbPlugin({\n      input: {\n        path: './openapi.yaml',\n      },\n      output: {\n        path: './src/generated',\n      },\n      // Optional: specify additional plugins\n      plugins: ['@kubb/swagger-ts', '@kubb/swagger-client'],\n    }),\n  ],\n});","lang":"typescript","description":"Shows how to integrate Kubb into a Vite project using the unplugin-kubb plugin with an OpenAPI spec."},"warnings":[{"fix":"Switch to ESM imports and set `\"type\": \"module\"` in package.json.","message":"ESM-only since v5: CommonJS require() not supported.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Upgrade Node.js to >=20.","message":"Minimum Node version raised to 20 in v5.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Place KubbPlugin early in the plugins array to ensure generated files are available.","message":"Plugin must be placed before other plugins that transform output files.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure all Kubb packages are on the same version range.","message":"Dependency on @kubb/core version ^4.0.0 may cause peer dependency conflicts if using Kubb v5 alpha.","severity":"gotcha","affected_versions":"5.0.0-alpha.x"},{"fix":"Use `input.url` instead of `input.path`.","message":"The `input` option `path` is deprecated in favor of `input.url` in v5 alpha.","severity":"deprecated","affected_versions":">=5.0.0-alpha.70"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install unplugin-kubb @kubb/core` and ensure tsconfig includes node_modules.","cause":"Package not installed or missing TypeScript declaration.","error":"Cannot find module 'unplugin-kubb' or its corresponding type declarations."},{"fix":"Use `import KubbPlugin from 'unplugin-kubb'` (ESM).","cause":"Using default import with require() or wrong import statement.","error":"TypeError: KubbPlugin is not a function"},{"fix":"Switch to `import` syntax or use dynamic import().","cause":"CommonJS require() used with ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported."},{"fix":"Provide `input` object with `path` or `url` property.","cause":"Missing or incorrectly configured `input` option.","error":"Uncaught TypeError: Cannot read properties of undefined (reading 'path')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}