From e33e8926cb297116a856ef6a96368da2fd7f1c16 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Tue, 2 Jul 2024 16:19:30 +0200 Subject: [PATCH] fix: fix handle .tsx extension --- packages/react-native-builder-bob/src/babel.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react-native-builder-bob/src/babel.ts b/packages/react-native-builder-bob/src/babel.ts index 25157727b..c7b992733 100644 --- a/packages/react-native-builder-bob/src/babel.ts +++ b/packages/react-native-builder-bob/src/babel.ts @@ -111,9 +111,10 @@ export default function ( node.source.value ); - // Add .js extension if .ts file or file with extension exists + // Add extension if .ts file or file with extension exists if ( doesFileExist(`${filename}.ts`) || + doesFileExist(`${filename}.tsx`) || doesFileExist(`${filename}.${extension}`) ) { node.source.value += `.${extension}`; @@ -122,7 +123,7 @@ export default function ( // Replace .ts extension with .js if .ts file exists if (doesFileExist(filename)) { - node.source.value = node.source.value.replace(/\.ts$/, `.${extension}`); + node.source.value = node.source.value.replace(/\.tsx?$/, `.${extension}`); return; } }