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

options.ts设为true后,无法编译jsx文件或 vue 使用 tsx语法 #9659

Closed
Sociosarbis opened this issue Jul 4, 2021 · 0 comments · Fixed by #9660 or #9858
Closed

options.ts设为true后,无法编译jsx文件或 vue 使用 tsx语法 #9659

Sociosarbis opened this issue Jul 4, 2021 · 0 comments · Fixed by #9660 or #9858
Labels
F-vue3 Framework - Vue 3 T-h5 Target - 编译到 H5 V-3 Version - 3.x
Milestone

Comments

@Sociosarbis
Copy link
Contributor

相关平台

H5

复现仓库

https://github.com/Sociosarbis/taro-preset-bug
浏览器版本: Edge 91
使用框架: Vue 3

复现步骤

yarn build:h5

期望结果

成功编译

实际结果

报错:Unterminated regular expression.

环境信息

Taro CLI 3.2.10 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.15.0 - D:\nodejs\node.EXE
      Yarn: 1.22.5 - E:\Yarn\bin\yarn.CMD

补充信息

这个问题原因是 01ba9a6 这个提交,虽然可让ts编译,但也带来了两个影响。

由于.jsx或vue中使用.jsx.tsx的扩展名都不为 .tsx,同时也没有将preset-typescript的isTSX的设为true,导致会将babel的jsx parser插件去掉。详情可查看@babel/plugin-syntax-typescript的源码

@taro-bot2 taro-bot2 bot added F-vue3 Framework - Vue 3 T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Jul 4, 2021
Sociosarbis added a commit to Sociosarbis/taro that referenced this issue Jul 4, 2021
Sociosarbis added a commit to Sociosarbis/taro that referenced this issue Jul 12, 2021
@Chen-jj Chen-jj added this to the 3.3.1 milestone Jul 20, 2021
Chen-jj added a commit that referenced this issue Jul 20, 2021
* fix(babel-preset-taro): fix #9659

* fix(babel-preset-taro): add @vue/babel-plugin-jsx and fix regression bug

* feat(babel-preset-app): 兼容vue2的jsx配置,增加vueJsx参数

Co-authored-by: fengjianlin <fengjianlin@moyi365.com>
Co-authored-by: chenjiajian <798095202@qq.com>
@ZakaryCode ZakaryCode moved this to Done in H5 Apr 10, 2023
@ZakaryCode ZakaryCode added this to H5 Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue3 Framework - Vue 3 T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants