esbuild-xyaml-plugin

raw JSON →
0.0.7 verified Fri May 01 auth: no javascript

An esbuild plugin for loading and transforming XYAML files. Version 0.0.7 is the current stable release. This plugin allows importing XYAML files directly into JavaScript/TypeScript bundles built with esbuild. It integrates with esbuild's build pipeline, converting XYAML content to JavaScript objects or strings. As a community-maintained plugin, it fills a niche for projects using XYAML as a data format. Compared to generic YAML loaders, it is purpose-built for the XYAML schema. Release cadence is irregular. The plugin is distributed as a CommonJS module and requires esbuild as a peer dependency.

error TypeError: xyamlPlugin is not a function
cause Importing the default export incorrectly or forgetting to call the plugin factory.
fix
Ensure you import the module correctly and invoke it: const xyamlPlugin = require('esbuild-xyaml-plugin'); ... plugins: [xyamlPlugin()]
error Error: Cannot find module 'esbuild'
cause esbuild is not installed.
fix
Install esbuild: npm install --save-dev esbuild
gotcha The plugin must be invoked as a function (e.g., xyamlPlugin()) to create the plugin object, not passed as a reference.
fix Call the imported default export: xyamlPlugin()
gotcha The package is CommonJS only; using ESM import without bundler support may fail.
fix Use require() or configure your bundler to handle CJS interop.
breaking No breaking changes reported for this version.
fix None.
npm install esbuild-xyaml-plugin
yarn add esbuild-xyaml-plugin
pnpm add esbuild-xyaml-plugin

Shows how to use the plugin with esbuild's build API, including loader configuration and plugin registration.

const esbuild = require('esbuild');
const xyamlPlugin = require('esbuild-xyaml-plugin');

esbuild.build({
  entryPoints: ['./src/index.js'],
  bundle: true,
  outfile: './dist/app/app.js',
  loader: {
    '.js': 'jsx',
  },
  sourcemap: true,
  target: ['chrome58', 'firefox57', 'safari11', 'edge16'],
  define: {
    'process.env.NODE_ENV': '"development"',
  },
  plugins: [xyamlPlugin()],
}).catch(() => process.exit(1));