wechat-miniprogram/miniprogram-compat

关于 Generator 函数的疑问

chenjiahan opened this issue · 1 comments

按照本仓库中的数据,从基础库 2.11 开始就可以使用 Generator 函数。

image

在我们的项目中,我们使用 @babel/preset-env@babel/plugin-transform-runtime 进行编译,将 target 设置为 iOS >= 10,同时关闭了开发者工具自带的 ES6 转 ES5增强编译,理论上是可以使用 Generator 的。

但我们在 iOS 10 真机验证过程中发现,Generator 会产生以下异常:

image

在开放社区中也有类似的反馈:

请问以上异常是否与小程序的 JS 执行环境有关呢?

基础库 2.17.1 之前的 generator 函数存在问题,建议尽量避免使用