taro3-不使用-typescript-的情况下使用-taro-ui-时报错

最近有个小程序的项目,用 taro3 脚手架创建了项目,在组件里引入了 taro-ui 的组件之后,执行 yarn dev:weapp 一直报错,报错内容是无法识别 taro-ui 里面的 ts 语法

报错信息

Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/chenlin/workspace/taro_test/node_modules/taro-ui/dist/weapp/components/swipe-action/index.tsx: Unexpected token, expected "{" (22:54)

20 | import AtSwipeActionOptions from './options/index'
21 |

22 | export default class AtSwipeAction extends AtComponent<
| ^
23 | AtSwipeActionProps,
24 | AtSwipeActionState
25 | > {
...

(node:6474) UnhandledPromiseRejectionWarning: [object Array]
(node:6474) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6474) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

后来搜了下官方 issue,发现有人遇到过这个问题,原因是 taro-ui 2.x 跟 taro 3.x 不兼容,需要安装 3.x 的 taro-ui

issue 地址:https://github.com/NervJS/taro-ui/issues/1179

阅读原文:小鑫の随笔

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值