新建的项目使用async报错regeneratorRuntime is not defined
-
这个报错信息,我按照网上的一系列方法都试过了,没有一个可行的,而且安装@tarojs/async-await依然没用,不知道咋整了。。。崩溃。。。
-
使用异步可以用官网上进阶指南中异步编程,安装 babel-plugin-transform-runtime 和 babel-runtime啊
-
首先,安装
babel-plugin-transform-runtime
然后修改 config/index.js 文件:
plugins: [ 'transform-decorators-legacy', 'transform-class-properties', 'transform-object-rest-spread', ['transform-runtime', { "helpers": false, "polyfill": false, "regenerator": true, "moduleName": 'babel-runtime' }] ]
在 Plugins 的配置中添加 transform-runtime 的配置信息。
就可以了。
-
@jd_billwong 问题解决了, 非常感谢 !
-
我按照这个来了一遍,还是报错!!!
-
@jd_5f18493445efb 按照上面的改了还是无效,请问你是怎么解决的?
-
@jd_4e51eb4163169 我也是!草