.jsx and .tsx files. Bun’s internal transpiler converts JSX syntax into vanilla JavaScript before execution.
Configuration
Bun reads yourtsconfig.json or jsconfig.json to determine how to perform the JSX transform internally. If you’d rather not use either, you can set the same options in bunfig.toml.
Bun respects the following compiler options.
jsx
How JSX constructs are transformed into vanilla JavaScript internally. The following table lists the possible values of jsx, along with how each transpiles this JSX component:
jsxFactory
Only applicable when
jsx is react."React.createElement". Set this for libraries like Preact that use a different function name ("h").
jsxFragmentFactory
Only applicable when
jsx is react.<>Hello</>. Default value is "React.Fragment".
jsxImportSource
Only applicable when
jsx is react-jsx or react-jsxdev.createElement, jsx, or jsxDEV) is imported from. Default value is "react". You’ll typically need this when using a component library like Preact.