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

refactor: improve logic to set react jsx type #681

Merged
merged 1 commit into from
Jul 23, 2023

Conversation

PeachScript
Copy link
Member

优化 React JSX 类型的识别逻辑,以满足某些场景下依赖声明里不存在 react 的场景(比如使用 @emotion/react),以及某些场景下不需要转换 React JSX 的场景,详细差异如下:

改动前:先判定是否存在 react 的依赖声明,再优先使用 tsconfig 的 jsx 设置,最后兜底根据 react 版本号决定 jsx 设置,无论如何都会启用 @babel/preset-react
改动后:优先使用 tsconfig 的 jsx 设置,再根据 react 版本号决定 jsx 设置,如果两者都不存在则不会启用 @babel/preset-react

@codecov
Copy link

codecov bot commented Jul 23, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (611f00c) 93.81% compared to head (e35e4cd) 93.80%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #681      +/-   ##
==========================================
- Coverage   93.81%   93.80%   -0.01%     
==========================================
  Files          54       54              
  Lines        1535     1534       -1     
  Branches      346      345       -1     
==========================================
- Hits         1440     1439       -1     
  Misses         95       95              
Impacted Files Coverage Δ
src/builder/utils.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@PeachScript PeachScript merged commit 6a87756 into master Jul 23, 2023
@delete-merged-branch delete-merged-branch bot deleted the feature/improve-react-jsx-logic branch July 23, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant