Skip to content

Commit

Permalink
feat: check if preact is being used in tsx (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
intrnl committed Oct 11, 2020
1 parent d002659 commit 1bfc48c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion snowpack/src/plugins/plugin-esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let esbuildService: Service | null = null;

const IS_PREACT = /from\s+['"]preact['"]/;
function checkIsPreact(filePath: string, contents: string) {
return filePath.endsWith('.jsx') && IS_PREACT.test(contents);
return (filePath.endsWith('.jsx') || filePath.endsWith('.tsx')) && IS_PREACT.test(contents);
}

function getLoader(filePath: string): 'js' | 'jsx' | 'ts' | 'tsx' {
Expand Down

1 comment on commit 1bfc48c

@vercel
Copy link

@vercel vercel bot commented on 1bfc48c Oct 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.