Skip to main content
Bun natively supports .yaml and .yml imports.
config.yaml

Import the file like any other source file.
config.ts

You can also use named imports to destructure top-level properties:
config.ts

Bun also supports Import Attributes syntax:
config.ts

For parsing YAML strings at runtime, use Bun.YAML.parse():
config.ts

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.yamlconfig.yaml.d.ts);
config.yaml.d.ts

See Docs > API > YAML for complete documentation on YAML support in Bun.