Skip to content

Commit

Permalink
Fix incorrect loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
nedjulius committed Dec 10, 2023
1 parent eb94b3c commit 90b06c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/esbuild-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ function stylexPlugin({
return;
}

const currFileExtension = path.extname(currFilePath);

const { code, metadata } = await babel.transformAsync(inputCode, {
babelrc: false,
filename: currFilePath,
presets,
plugins: [
...plugins,
/\.jsx?/.test(path.extname(currFilePath))
/\.jsx?/.test(currFileExtension)
? flowSyntaxPlugin
: [typescriptSyntaxPlugin, { isTSX: true }],
jsxSyntaxPlugin,
Expand All @@ -105,7 +107,8 @@ function stylexPlugin({

return {
contents: code,
loader: currFilePath.endsWith('.js') ? 'js' : 'tsx',
// remove dot from extension
loader: currFileExtension.slice(1),
};
});
},
Expand Down

0 comments on commit 90b06c3

Please sign in to comment.