Skip to main content
Bun natively supports .xml imports.
config.xml

Import the file like any other source file. The module is the parsed document: one key for the root element, "@name" keys for attributes, arrays for repeated elements, and every value a string.
config.ts

The root element is also available as a named import:
config.ts

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

See XML for the rest of Bun’s XML support, including the ordered { compact: false } node tree and Bun.XML.stringify().