Skip to content
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

TypeScript builds ignore tsconfig compilerOptions.jsx. Output is always 'react-jsx' #678

Open
1 of 2 tasks
marklawlor opened this issue Nov 8, 2024 · 2 comments
Open
1 of 2 tasks
Labels
bug Something isn't working

Comments

@marklawlor
Copy link

Description

Libraries built with react-native-builder-bob do not respect the tsconfig.config#compilerOptions.jsx setting, and force the output to be react-jsx. This is a problem for React Native libraries which normally publish as jsx: 'react-native' or 'preserve'.

Libraries such as @emotion/native and NativeWind both rely on setting a custom jsxImportSource, which only works when a library has been published with persevered JSX. This means libraries built with react-native-builder-bob will stop working with these libraries.

The cause of this issue is the babel-preset, which should conditionally turn off '@babel/plugin-transform-react-jsx' / '@babel/plugin-transform-react-jsx-development' when jsx is set to react-native or preserve.

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

Link to repro

https://github.com/marklawlor/react-native-builder-bob-jsx

Environment

@marklawlor marklawlor added the bug Something isn't working label Nov 8, 2024
@marklawlor marklawlor changed the title The jsx option from tsconfig#compilerOptions is not respected TypeScript builds ignore tsconfig compilerOptions.jsx. Output is always 'react-jsx' Nov 8, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 21, 2024
<!-- Please provide enough information so that others can review your
pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

In
0595213
the JSX runtime was changed to `automatic` without the option for the
user to opt back in for `classic`.

The `classic` runtime is needed for NativeWind library, which is
dependent on Reanimated.

Fixes
-
software-mansion/react-native-reanimated#6665
- #678 

### Test plan

🚀

---------

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
@atlj
Copy link
Collaborator

atlj commented Nov 21, 2024

Fixed by #695

@atlj atlj closed this as completed Nov 21, 2024
@marklawlor
Copy link
Author

marklawlor commented Nov 21, 2024

Please reopen the issue, the tsconfig#jsx option is different to setting the runtime to classic or automatic

Please see software-mansion/react-native-reanimated#6665 (comment) for more context

@atlj atlj reopened this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants