Open 953133667 opened 4 years ago
import { fixF2 } from "taro-f2/dist/weapp/common/f2-tool.ts";
./node_modules/taro-f2/dist/weapp/common/f2-tool.ts Module build failed (from ./node_modules/@tarojs/mini-runner/node_modules/babel-loader/lib/index.js): SyntaxError: /Users/kedehua/projects_2020/ding-pt-school/node_modules/taro-f2/dist/weapp/common/f2-tool.ts: Unexpected token, expected "," (3:25) 1 | import Taro from '@tarojs/taro' 2 | > 3 | export function fixF2 (F2: any): any { | ^ 4 | if( ( !F2 ) || F2.TaroFixed){return F2} 5 | if (process.env.TARO_ENV !== 'h5') { 6 | function strLen(str) {
我的项目是不支持ts ,请问各位大佬怎么解决?
在taro项目下安装typescript: npm install typescript
npm install typescript
然后修改babel.config.js,设置ts: true
module.exports = { presets: [ ['taro', { framework: 'react', ts: true }] ] }
在 index.jsx 中引入 fixF2
报错如下
我的项目是不支持ts ,请问各位大佬怎么解决?