.yaml
and .yml
imports.
config.yaml
Import the file like any other source file.
You can also use named imports to destructure top-level properties:
Bun also supports Import Attributes syntax:
For parsing YAML strings at runtime, use
Bun.YAML.parse()
:
TypeScript Support
To add TypeScript support for your YAML imports, create a declaration file with.d.ts
appended to the YAML filename (e.g., config.yaml
→ config.yaml.d.ts
);
See Docs > API > YAML for complete documentation on YAML support in Bun.