Taro 写个微信小程序遇到的问题

######################################################

问题:

使用 taro v4.0.9 出现如下提示 Parsing error: No Babel config file detected for K:\Studio\Coding\Taro\OdooFrontend\odoo-miniprogram\config\dev.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.

解决方法:

方法 1:

修改.eslintrc 文件的内容为:

{

"extends": ["taro/react"],

"parser": "@babel/eslint-parser",

"parserOptions": {

"requireConfigFile": false, // 关键配置:禁用 Babel 配置文件检查

"ecmaFeatures": {

"jsx": true

},

"ecmaVersion": 2020,

"sourceType": "module"

},

"rules": {

"react/jsx-uses-react": "off",

"react/react-in-jsx-scope": "off"

}

}

方法 2:

删掉文件.eslintrc

方法 3 (未验证此方法):

要配置文件 .eslintrc.js 添加如下代码:

module.exports = {

parser: '@babel/eslint-parser',

parserOptions: {

requireConfigFile: false,

babelOptions: {

configFile: './babel.config.js' // 指向你的 Babel 配置文件

}

},

// 其他 ESLint 配置...

};

如果配置文件 .eslintrc.json 是解决不了这个问题的

######################################################

测试了很多的 UI 方案,包括 VantWeapp,NutUI(安装报错,目前跟 Taro4.0.9 不适配, yarn add taro-ui@next),

ColorUI(只适用于 UniApp 和原生微信小程序), Taro UI(官网维护很差,找不到文档),

taroify(有警告,但是至少能用)

最终决定使用 taroify

https://taroify.github.io/taroify.com/quickstart/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值