From 69982405b3649222105c1e25a873378b16a7e6cf Mon Sep 17 00:00:00 2001 From: yinhangfeng Date: Wed, 14 May 2025 12:55:16 +0800 Subject: [PATCH] feat: optimize support for tsx and jsx files --- src/output/moduleCompiler.ts | 4 +++- src/store.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output/moduleCompiler.ts b/src/output/moduleCompiler.ts index b7f3266d..95853824 100644 --- a/src/output/moduleCompiler.ts +++ b/src/output/moduleCompiler.ts @@ -121,7 +121,9 @@ function processModule(store: Store, src: string, filename: string) { const file = files[resolved] || files[(resolved = raw + '.ts')] || - files[(resolved = raw + '.js')] + files[(resolved = raw + '.js')] || + files[(resolved = raw + '.tsx')] || + files[(resolved = raw + '.jsx')] return file ? resolved : undefined } diff --git a/src/store.ts b/src/store.ts index 2508b679..07d06bb0 100644 --- a/src/store.ts +++ b/src/store.ts @@ -513,7 +513,7 @@ export class File { if (this.filename.endsWith('.css')) { return 'css' } - if (this.filename.endsWith('.ts')) { + if (this.filename.endsWith('.ts') || this.filename.endsWith('.tsx')) { return 'typescript' } return 'javascript'