-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .jsx
and .tsx
by default?
#138
Comments
I am open to supporting tsx. Do you mind to open a PR with change + a test fixture for usage? (how are we going to provide a default |
Sure, I will take a look at this. I'm not sure what you mean by |
Render function. When JSX is transformed, a render function is expected. |
@paulrosania Did you found a workaround until the feature is implemented? |
Unfortunately no, I have not had time to look into this further. For now I'm using this patch (via https://gist.github.com/paulrosania/4c21f6592e241e49d34f1fdc6586ef96 |
@pi0 I would like to create a pull request. However, |
For example this: export const Test = () => <div>42</div>; It needs to be transpiled to this: export const Test = () => h("div", null, "42"); And jiti should support an option to specific what global |
I would like to solve this! |
Describe the feature
Would you be open to adding
.jsx
and.tsx
extensions to the default set? Currently, in React projects, Jiti throws "Cannot find module" errors when parsing files that import JSX/TSX. TypeScript typically loads these automatically, so it's a cryptic issue that is likely to trip people up. (I spent over an hour tracking it down.) Since Jiti is used as middleware in other tools (in my case, by GraphQL Code Generator), this error is typically not something a user is prepared to debug, since they may not even realize Jiti is used under the hood.JSX/TSX are typically supported automatically by TypeScript itself so this feels like a safe change, if you're open to it! 🤞🏼
Addendum: For
.tsx
specifically, I believeisTypescript
would also need to be updated for this to work. That feels extremely safe since.tsx
files are always TypeScript.Additional information
The text was updated successfully, but these errors were encountered: