Skip to content

Commit

Permalink
fix: enable esbuildOptions.loader in optimizeDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
弘树 committed Feb 11, 2022
1 parent 7973ea4 commit cb78711
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/optimizer/index.ts
Expand Up @@ -253,7 +253,9 @@ export async function optimizeDeps(
`Unable to parse dependency: ${id}. Trying again with a JSX transform.`
)
const transformed = await transformWithEsbuild(entryContent, filePath, {
loader: 'jsx'
loader: esbuildOptions.loader
? esbuildOptions.loader[path.extname(filePath)]
: 'jsx'
})
// Ensure that optimization won't fail by defaulting '.js' to the JSX parser.
// This is useful for packages such as Gatsby.
Expand Down

0 comments on commit cb78711

Please sign in to comment.