{"id":22153,"library":"rollup-plugin-openapi","title":"@zauni/rollup-plugin-openapi","description":"Converts OpenAPI YAML files (OpenAPI 3.0, Swagger 2) into ES6 modules for Rollup and Vite. Version 3.0.1 ships TypeScript definitions, supports `$ref` resolution, and works with Vite's HMR. Different from general YAML loaders: it parses OpenAPI spec, validates, and produces structured code module. Requires Node >=18. Released on JSR as well. Actively maintained with frequent releases based on CI.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/zauni/rollup-plugin-openapi","tags":["javascript","rollup","vite","plugin","rollup-plugin","vite-plugin","openapi","swagger","yaml","typescript"],"install":[{"cmd":"npm install rollup-plugin-openapi","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-openapi","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-openapi","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides include/exclude pattern matching","package":"@rollup/pluginutils","optional":false},{"reason":"TypeScript types for OpenAPI objects used internally","package":"openapi-types","optional":false}],"imports":[{"note":"Default export only; named export does not exist.","wrong":"import { openapi } from 'rollup-plugin-openapi'","symbol":"openapi (default)","correct":"import openapi from 'rollup-plugin-openapi'"},{"note":"CJS works but ESM is preferred; require returns the default export.","wrong":"const { openapi } = require('rollup-plugin-openapi')","symbol":"openapi (CommonJS)","correct":"const openapi = require('rollup-plugin-openapi')"},{"note":"You must create a .d.ts file with that triple-slash directive, not an import.","wrong":"import './yaml.d.ts'","symbol":"Type declaration for yaml files","correct":"/// <reference types=\"rollup-plugin-openapi/types/yaml\" />"}],"quickstart":{"code":"import openapi from 'rollup-plugin-openapi';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'output',\n    format: 'esm',\n  },\n  plugins: [\n    openapi({\n      include: ['**/*.yaml', '**/*.yml'],\n      exclude: 'node_modules/**',\n    }),\n  ],\n};","lang":"typescript","description":"Rollup config that imports OpenAPI YAML files as ES modules with include/exclude options."},"warnings":[{"fix":"Upgrade Node.js to v18 or later.","message":"Node.js >=18 is required; older versions cause runtime errors.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Create a .d.ts file with `/// <reference types=\"rollup-plugin-openapi/types/yaml\" />`","message":"TypeScript users must add a triple-slash reference for .yaml imports; otherwise TS fails with 'Cannot find module'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use `npm install rollup-plugin-openapi` instead of jsr install.","message":"The JSR package @zauni/rollup-plugin-openapi is available alongside npm; prefer npm for broader compatibility.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Inline remote references or download them locally before build.","message":"Plugin only works with `$ref` that point to local files; remote $ref (HTTP) are not supported and silently fail.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev rollup-plugin-openapi` and ensure no typo in import.","cause":"Missing dev dependency or wrong import path.","error":"Error: Cannot find module 'rollup-plugin-openapi'"},{"fix":"Use `import openapi from 'rollup-plugin-openapi'` (no braces).","cause":"Importing as named export instead of default.","error":"TypeError: openapi is not a function"},{"fix":"Create a .d.ts file with `/// <reference types=\"rollup-plugin-openapi/types/yaml\" />`","cause":"Missing TypeScript declaration for YAML imports.","error":"Cannot find module './api.yaml' or its corresponding type declarations."},{"fix":"Remove braces: `import openapi from 'rollup-plugin-openapi'`","cause":"Using named import instead of default import.","error":"The requested module 'rollup-plugin-openapi' does not provide an export named 'openapi'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}