PKL file import plugin for Vite.
Uses @pkl-community/node-packages package for parsing.
Warning
- This is an experimental plugin and depends on @pkl-community/node-packages.
- Check https://github.com/pkl-community/node-packages/issues for known issues.
npm install vite-plugin-pkl --save-devAdd it in vite.config.js:
import pkl from 'vite-plugin-pkl'
export default {
plugins: [
pkl(),
// ...other vite plugins
]
}plugins: [
pkl({
debug: true // default: false - Output before/after in Vite console.
}),Import like a regular JSON file:
import test from './test.pkl'
console.log(test.key) // 'value'- Some expressions need to be escaped with a backslash:
"Hello, \(bird.name)!" - No Windows support yet.