The plugin was useful with Vite 1 but now that most of the Rollup plugins, including @rollup/plugin-yaml, are compatible with Vite 2, it is recommended to use them.
A Vite plugin for import YAML/YML files as ES6 modules.
Like @rollup/plugin-yaml but for Vite.
Using npm :
npm i -D vite-plugin-yaml
Using yarn :
yarn add -D vite-plugin-yaml
module.exports = {
plugins: [require('vite-plugin-yaml')]
}
const config = {
plugins: [require('vite-plugin-yaml')]
}
export default config
You can now import YAML/YML files.
import object from './object.yml'
Check the playground for an example of use.