Skip to content

Commit

Permalink
slightly safer matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Walker-GM committed Jun 21, 2024
1 parent ba59bfb commit a3606f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function prebuildWebFile(srcPath: string, flags: Flags = {}) {
export async function transform(srcPath: string) {
const code = fs.readFileSync(srcPath, 'utf-8')

const loader = path.extname(srcPath).startsWith('.ts') ? 'tsx' : 'jsx'
const loader = path.extname(srcPath).match(/^\.m?ts/) ? 'tsx' : 'jsx'
const transformed = await transformWithEsbuild(code, srcPath, {
loader,
})
Expand Down

0 comments on commit a3606f7

Please sign in to comment.