diff --git a/.changeset/tiny-buses-hide.md b/.changeset/tiny-buses-hide.md new file mode 100644 index 00000000..e4f77539 --- /dev/null +++ b/.changeset/tiny-buses-hide.md @@ -0,0 +1,5 @@ +--- +"@astrojs/compiler": patch +--- + +Fixes a bug caused by having an extra space in the fragment tag in the TSX output diff --git a/internal/printer/print-to-tsx.go b/internal/printer/print-to-tsx.go index 2187317c..a353345a 100644 --- a/internal/printer/print-to-tsx.go +++ b/internal/printer/print-to-tsx.go @@ -706,10 +706,7 @@ declare const Astro: Readonly): any {}\n assert.snapshot(code, output, 'expected code to match snapshot'); }); +test('fragment with leading linebreak', async () => { + const input = ` +<>Test123`; + const output = `${TSXPrefix} +<>Test123 + +export default function __AstroComponent_(_props: Record): any {}\n`; + const { code } = await convertToTSX(input, { sourcemap: 'external' }); + assert.snapshot(code, output, 'expected code to match snapshot'); +}); + test.run();