unplugin-yaml
unplugin-yaml
Allow import YAML file for Vite, Webpack, Rollup and esbuild. With TypeScript support. Powered by unplugin.
Install
npm i -D unplugin-yaml
Usage
[!TIP] You can view all examples here.
// vite.config.ts
import YAMLPlugin from "unplugin-yaml/vite";
export default defineConfig({
plugins: [YAMLPlugin({/* options */})],
});
// rollup.config.js
import YAMLPlugin from "unplugin-yaml/rollup";
export default {
plugins: [YAMLPlugin({/* options */})],
};
// webpack.config.js
module.exports = {
/* ... */
plugins: [require("unplugin-yaml/webpack").default({/* options */})],
};
// nuxt.config.js
export default defineNuxtConfig({
modules: [["unplugin-yaml/nuxt", {/* options */}]],
});
// astro.config.mjs
import { defineConfig } from "astro/config";
import YAMLPlugin from "unplugin-yaml/astro";
// https://astro.build/config
export default defineConfig({
integrations: [YAMLPlugin({/* options */})],
});
// esbuild.config.js
import { build } from "esbuild";
import YAMLPlugin from "unplugin-yaml/esbuild";
build({
/* ... */
plugins: [YAMLPlugin({/* options */})],
});
// rspack.config.mjs
import rspack from "@rspack/core";
import YAMLPlugin from "unplugin-yaml/rspack";
/** @type {import('@rspack/core').Configuration} */
export default {
plugins: [
new rspack.HtmlRspackPlugin({
template: "./index.html",
}),
YAMLPlugin(),
],
};
// rolldown.config.js
import { defineConfig } from "rolldown";
import YAMLPlugin from "unplugin-yaml/rolldown";
export default defineConfig({
input: "./index.js",
plugins: [YAMLPlugin({/* options */})],
});
Configuration
YAMLPlugin({
include: [
/\.yamlcustom$/, // .yamlcustom
],
parserOptions: {
// see yaml load options
},
});
TypeScript
If you are using TypeScript, you need to add the following to your tsconfig.json file:
{
"compilerOptions": {
"types": ["unplugin-yaml/types"]
}
}
📄 License
Published under MIT License.
Related Packages
@relevate/unplugin-poolster
Run Poolster OpenAPI generation from Vite, Rollup, webpack, esbuild, Rspack, Rol...
197
3
unplugin-strip-whitespace
Unplugin to strip inter-node whitespace in Astro and Svelte templates (Vite/Roll...
787
0
Version History
| Version | Released | License |
|---|---|---|
| 4.3.1 | MIT | |
| 4.3.0 | MIT | |
| 4.2.1 | MIT | |
| 4.2.0 | MIT | |
| 4.1.0 | MIT | |
| 4.0.1 | MIT | |
| 4.0.0 | MIT | |
| 3.0.7 | MIT | |
| 3.0.6 | MIT | |
| 3.0.5 | MIT | |
| 3.0.4 | MIT | |
| 3.0.3 | MIT | |
| 3.0.2 | MIT | |
| 3.0.1 | MIT | |
| 3.0.0 | MIT | |
| 2.2.0 | MIT | |
| 2.1.0 | MIT | |
| 2.0.1 | MIT | |
| 2.0.0 | MIT | |
| 1.3.0 | MIT | |
| 1.2.0 | MIT | |
| 1.1.0 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT | |
| 0.6.0 | MIT | |
| 0.5.2 | MIT | |
| 0.5.1 | MIT | |
| 0.5.0 | MIT | |
| 0.4.0 | MIT | |
| 0.3.0 | MIT |
Showing the latest 30 of 35. See every release on npm