{"id":22885,"library":"vite-plugin-toml","title":"vite-plugin-toml","description":"A Vite and Rollup plugin for importing TOML files. Current stable version is 0.8.7, with updates aligned to Vite's release cadence. Uses toml-eslint-parser for TOML 1.0.0 support. Supports both Vite and Rollup despite the name. Key differentiator: integrates directly as a Vite/Rollup plugin with options for named exports and big integers, unlike alternatives that require separate TOML parsing libraries.","status":"active","version":"0.8.7","language":"javascript","source_language":"en","source_url":"https://github.com/sapphi-red/vite-plugin-toml","tags":["javascript","vite","rollup","rollup-plugin","toml"],"install":[{"cmd":"npm install vite-plugin-toml","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-toml","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-toml","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Rollup integration","package":"rollup","optional":false}],"imports":[{"note":"Named export only; no default export.","wrong":"import ViteToml from 'vite-plugin-toml'","symbol":"ViteToml","correct":"import { ViteToml } from 'vite-plugin-toml'"},{"note":"Default import returns parsed object unless namedExports option is enabled.","wrong":"import { data } from './config.toml'","symbol":"default import for .toml files","correct":"import data from './config.toml'"},{"note":"Generic unknown type recommended; better to use a more specific type or typescript-plugin-toml.","wrong":"declare module '*.toml' { const value: Record<string, unknown>; export default value; }","symbol":"TypeScript module declaration","correct":"declare module '*.toml' { const value: unknown; export default value; }"}],"quickstart":{"code":"// vite.config.ts\nimport { ViteToml } from 'vite-plugin-toml'\n\n// basic usage\nexport default {\n  plugins: [ViteToml()]\n}\n\n// with named exports\nexport default {\n  plugins: [ViteToml({ namedExports: true })]\n}\n\n// Rollup usage (rollup.config.js)\nimport { ViteToml } from 'vite-plugin-toml'\nexport default {\n  plugins: [ViteToml()]\n}","lang":"typescript","description":"Shows how to add the plugin in Vite or Rollup config, including named exports option."},"warnings":[{"fix":"Ensure your TOML files conform to TOML 1.0.0 spec.","message":"v0.3.0 dropped support for TOML 0.5.0 and only supports TOML 1.0.0.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"No change needed; just note it works with Rollup too.","message":"The package name 'vite-plugin-toml' is historical; the plugin also works with Rollup but the name may mislead.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Enable namedExports option or use default import.","message":"Default import returns the parsed object; named imports (like import { key } from './file.toml') only work when namedExports option is true.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Use import statements instead of require().","message":"Using require() syntax (CommonJS) may not work in Vite/ESM environments; prefer ESM imports.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to import { ViteToml } from 'vite-plugin-toml'","cause":"Incorrect import style (default import instead of named import).","error":"ViteToml is not defined"},{"fix":"Update TOML file to comply with TOML 1.0.0 spec.","cause":"TOML file contains TOML 0.5.0 syntax not supported in TOML 1.0.0.","error":"Unrecognized TOML syntax: <line>"},{"fix":"Add declare module '*.toml' { const value: unknown; export default value; } to a .d.ts file.","cause":"Missing type declaration for .toml files.","error":"TypeScript cannot find module './file.toml'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}