callstack / callstack/react-native-builder-bob

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

未关闭
#678 2 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
JavaScript
星标
3.2k
派生
228
平均合并
7 天 12 小时
30 天内合并 PR
3

描述

### 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
- [x] react-native-builder-bob

### Selected options

-

### Link to repro

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

### Environment

-

贡献指南

打开贡献指南

调研方向

先从 babel-preset 和链接的复现开始,然后将其行为与 tsconfig compilerOptions.jsx 设置为 react-native 或 preserve 时的行为进行比较。确认这些设置会阻止应用 JSX transform plugins;完成的标准是 build 保留配置的 JSX 输出,而不是始终生成 react-jsx。

由索引模型根据 Issue 内容生成。

评估

技术栈
babel, javascript, react-native, typescript
领域
build-system, mobile
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。