README
vite-plugin-toml
Toml file plugin for vite.
Vite v2 is supported from
v0.2.x
, Vite v1 is not supported from this version
Uses @ltd/j-toml
package for parsing.
Supports Toml 1.0.0.
Install
npm i -D vite-plugin-toml # yarn add -D vite-plugin-toml
Add plugin in vite.config.js
.
import { ViteToml } from 'vite-plugin-toml'
export default {
plugins: [
ViteToml()
]
}
Options
useBigInt
(default:true
)
https://github.com/LongTengDao/j-toml/tree/master/docs/English#usebigint
namedExports
(default:false
)
Enable named exports.
Typescript
I recommend using typescript-plugin-toml.
Alternatively, add this global declaration.
declare module '*.toml' {
const value: unknown
export default value
}
Example
test.toml
key = 'value'
index.ts
import test from './test.toml'
console.log(test.key) // 'value'