Skip to content

Use Bun.build to transpile a single file #8335

Discussion options

You must be logged in to vote

Found the answer:

const transpiler = new Bun.Transpiler({ loader: 'tsx', tsconfig: { compilerOptions: { jsx: 'react' } } });
const typeScript = await Bun.file('./test/Test.tsx').text();
const javaScript = await transpiler.transform(typeScript);
console.log(javaScript);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@edemaine
Comment options

Answer selected by TomasHubelbauer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants