wechat-miniprogram/miniprogram-cli

使用 async/await 语法报错

yzqzy opened this issue · 3 comments

yzqzy commented

use custom_component template

Error:ReferenceError: regeneratorRuntime is not defined

是执行 cli 命令失败么?具体是跑什么命令时失败的?

我执行 miniprogram init -t custom-component -n test-cli-custom-component 看起来正常。

如果是模板里面没有支持 async/await 的话,按需求手动补一下 babel 配置就行。不过模板现在更推荐用这个,支持能力更加完善:https://github.com/wechat-miniprogram/mpflow

yzqzy commented

模板中没有支持 async/await 语法,自己尝试添加 babel 配置失败。

模板问题直接自己按需补充对应的 preset 或者 plugin 即可。