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 destructure top-level properties with named imports:
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 (for example, config.yamlconfig.yaml.d.ts):
config.yaml.d.ts

See YAML.