Skip to content

Commit

Permalink
fix: fix handle .tsx extension
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Jul 2, 2024
1 parent 493a953 commit e33e892
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/react-native-builder-bob/src/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand All @@ -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;
}
}
Expand Down

0 comments on commit e33e892

Please sign in to comment.