Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ViteToml
✓ import { ViteToml } from 'vite-plugin-toml'
✗ import ViteToml from 'vite-plugin-toml'
Named export only; no default export.
default import for .toml files
✓ import data from './config.toml'
✗ import { data } from './config.toml'
Default import returns parsed object unless namedExports option is enabled.
TypeScript module declaration
✓ declare module '*.toml' { const value: unknown; export default value; }
✗ declare module '*.toml' { const value: Record<string, unknown>; export default value; }
Generic unknown type recommended; better to use a more specific type or typescript-plugin-toml.
Shows how to add the plugin in Vite or Rollup config, including named exports option.
// vite.config.ts
import { ViteToml } from 'vite-plugin-toml'
// basic usage
export default {
plugins: [ViteToml()]
}
// with named exports
export default {
plugins: [ViteToml({ namedExports: true })]
}
// Rollup usage (rollup.config.js)
import { ViteToml } from 'vite-plugin-toml'
export default {
plugins: [ViteToml()]
}
Errors
Common errors & fixes
ViteToml is not defined
Incorrect import style (default import instead of named import).
fixChange to import { ViteToml } from 'vite-plugin-toml' Unrecognized TOML syntax: <line>
TOML file contains TOML 0.5.0 syntax not supported in TOML 1.0.0.
fixUpdate TOML file to comply with TOML 1.0.0 spec.
TypeScript cannot find module './file.toml'
Missing type declaration for .toml files.
fixAdd declare module '*.toml' { const value: unknown; export default value; } to a .d.ts file. Audit
Dependencies
rolluprequiredPeer dependency required for Rollup integration