You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
esbuild determines "jsx" and "jsxImportSource" settings from the options provided to build() and the tsconfig.json file nearest to the source file, with the tsconfig having a higher precedence, and the explicitly provided options used as the fallback.
When a tsx or jsx file is loaded by a plugin, however, the tsconfig is not looked up. This puts the plugin in an awkward position as it must determine the project's JSX settings on its own and manually transform the JSX into JS to provide it to the "js" loader.
This may appear as expected behavior since esbuild needs to know where to look for the tsconfig file and a disk location doesnt make sense for a virtual module. However, it remains an issue even when a resolveDir is provided, which should be a sufficient hint.
If resolveDir is not appropriate for tsconfig lookup, esbuild could alternatively provide the resolved and parsed options so that the plugin can use them to call esbuild.transform with the appropriate settings. Either way, the goal is to allow a virtual TSX module to "inherit" the compilerOptions of its importer.
The text was updated successfully, but these errors were encountered:
Reproduction
https://stackblitz.com/edit/node-y5qbrynb?file=index.tsx
esbuild determines
"jsx"
and"jsxImportSource"
settings from the options provided tobuild()
and thetsconfig.json
file nearest to the source file, with the tsconfig having a higher precedence, and the explicitly provided options used as the fallback.When a tsx or jsx file is loaded by a plugin, however, the tsconfig is not looked up. This puts the plugin in an awkward position as it must determine the project's JSX settings on its own and manually transform the JSX into JS to provide it to the
"js"
loader.This may appear as expected behavior since esbuild needs to know where to look for the tsconfig file and a disk location doesnt make sense for a virtual module. However, it remains an issue even when a
resolveDir
is provided, which should be a sufficient hint.If
resolveDir
is not appropriate for tsconfig lookup, esbuild could alternatively provide the resolved and parsed options so that the plugin can use them to callesbuild.transform
with the appropriate settings. Either way, the goal is to allow a virtual TSX module to "inherit" the compilerOptions of its importer.The text was updated successfully, but these errors were encountered: