{"id":22957,"library":"vite-yaml-plugin","title":"vite-yaml-plugin","description":"Vite plugin to import YAML files (.yaml/.yml) as JavaScript modules, using js-yaml internally. Version 2.0.4, actively maintained, minimal dependencies (only js-yaml as a dependency, vite as peer). Key differentiator: lightweight alternative to vite-plugin-yaml, supports TypeScript declaration augmentation, configurable file matching and yaml options. Suitable for Vite projects needing YAML data imports with zero configuration overhead.","status":"active","version":"2.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/silverwind/vite-yaml-plugin","tags":["javascript","typescript"],"install":[{"cmd":"npm install vite-yaml-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add vite-yaml-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-yaml-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export, not default.","wrong":"import yamlPlugin from 'vite-yaml-plugin'","symbol":"yamlPlugin","correct":"import { yamlPlugin } from 'vite-yaml-plugin'"},{"note":"Types are provided as ambient declarations, not exported from the package.","wrong":"import { YamlFile } from 'vite-yaml-plugin'","symbol":"YamlFile type","correct":"// no explicit type import needed; use ambient types via tsconfig or declare module"},{"note":"CommonJS require must destructure the named export.","wrong":"const yamlPlugin = require('vite-yaml-plugin')","symbol":"yamlPlugin (CommonJS require)","correct":"const { yamlPlugin } = require('vite-yaml-plugin')"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite';\nimport { yamlPlugin } from 'vite-yaml-plugin';\n\nexport default defineConfig({\n  plugins: [\n    yamlPlugin(),\n  ],\n});\n\n// Then in any module:\nimport foo from './foo.yaml';\nconsole.log(foo);\n\n// For TypeScript, add to tsconfig.json:\n// {\n//   \"compilerOptions\": {\n//     \"types\": [\"vite-yaml-plugin/types\"]\n//   }\n// }","lang":"typescript","description":"Shows basic setup of the plugin in vite.config.js and usage in a module, plus TypeScript type augmentation."},"warnings":[{"fix":"Use `yamlPlugin()` instead of `yamlPlugin` in the plugins array.","message":"Plugin must be called as a function, not passed directly as object.","severity":"gotcha","affected_versions":"*"},{"fix":"Add 'vite-yaml-plugin/types' to the 'types' array in tsconfig.json.","message":"TypeScript ambient types require adding 'vite-yaml-plugin/types' to compilerOptions.types, not just importing.","severity":"gotcha","affected_versions":"*"},{"fix":"Update to v2 and use named import { yamlPlugin } from 'vite-yaml-plugin'.","message":"Older versions (1.x) may have used a different import path or default export.","severity":"deprecated","affected_versions":"<2.0"}],"env_vars":null,"search_vec":"'2.0.4':21 'activ':22 'altern':39 'augment':48 'configur':49,65 'data':61 'declar':47 'depend':25,32 'differenti':37 'file':10,50 'import':8,62 'intern':19 'javascript':13,67 'js':17,28 'js-yaml':16,27 'key':36 'lightweight':38 'maintain':23 'match':51 'minim':24 'modul':14 'need':59 'option':54 'overhead':66 'peer':35 'plugin':4,6,43 'project':58 'suitabl':55 'support':45 'typescript':46,68 'use':15 'version':20 'vite':2,5,33,42,57 'vite-plugin-yaml':41 'vite-yaml-plugin':1 'yaml':3,9,18,29,44,53,60 'yaml/.yml':11 'zero':64","created_at":"2026-04-27T17:07:59.379314+00:00","updated_at":"2026-04-27T17:07:59.379314+00:00","problems":[{"fix":"Add 'vite-yaml-plugin/types' to compilerOptions.types in tsconfig.json, or provide a custom declaration file.","cause":"Missing TypeScript types setup.","error":"Cannot find module 'vite-yaml-plugin' or its corresponding type declarations."},{"fix":"Change import statement to: import { yamlPlugin } from 'vite-yaml-plugin'","cause":"Using default import instead of named import.","error":"The requested module 'vite-yaml-plugin' does not provide an export named 'default'"},{"fix":"Use `yamlPlugin()` with parentheses in the plugins array.","cause":"Passing the function reference instead of calling it in the plugins array.","error":"TypeError: yamlPlugin is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/silverwind/vite-yaml-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-yaml-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}