diff --git a/packages/typewind/src/transform.ts b/packages/typewind/src/transform.ts index 03bdf19..33fec03 100644 --- a/packages/typewind/src/transform.ts +++ b/packages/typewind/src/transform.ts @@ -16,12 +16,12 @@ export const transformBabel = (ext: string, content: string) => { const res = babel.transformSync(content, config); - if (res?.code) { - return res?.code; + if (res?.code == undefined) { + throw new Error('Failed to transform file'); } - throw new Error('Failed to transform file'); -} + return res.code; +}; export const typewindTransforms: Record = { tsx: (content) => transformBabel('tsx', content),