ecomfe / okam

Mini program development framework
https://ecomfe.github.io/okam
MIT License
416 stars 65 forks source link

async 报错 ReferenceError: regeneratorRuntime is not defined #2

Closed nyrf closed 5 years ago

nyrf commented 5 years ago
regeneratorRuntime is not defined; [Component] Event Listener Error @ components/Hello#(anonymous)
ReferenceError: regeneratorRuntime is not defined
created () {
        this.getData()
},

methods: {
    async getData () {
         console.log('result')
    }
}

在base.config.js中加入了 polyfill: ['promise', 'async']

环境:

node : v10.05 okam: 0.3.0, 微信小程序

wuhy commented 5 years ago

目前针对微信增加async/await polyfill,是基于 localPolyfill 配置,由于微信无法增加全局 polyfill,因此其它小程序请使用 polyfill 配置。然后针对你上述问题,是由于目前解析 async/await 语法只分析了 await 语法,如果正常代码一般不会存在只有 async 关键字,而没有存在任何 await 语句。针对 async/await 语法分析,我们再优化完善下。

nyrf commented 5 years ago

这个可以了,谢谢