ecomfe / okam

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

百度小程序无法找到 regeneratorRuntime 问题 #53

Closed qianliu013 closed 4 years ago

qianliu013 commented 4 years ago

问题类型

问题详情

百度小程序近期上线了非兼容性改动,这将导致无法在小程序中获取全局变量(如通过 window/root/global/Function('return this')() 等), 使得无法将一些属性挂载在全局变量,从而导致小程序运行异常。

典型的例子:使用了 async,编译后的代码运行会往全局变量挂载 regeneratorRuntime 属性。

对于 Okam 的影响:如果使用了 polyfill: ['async'](目前的 swan.config.js 默认配置), 请在 swan.config.js 中将 polyfill 改为 localPolyfill,并重新编译上传包

期望效果

实际情况

复现步骤 和 问题示例

代码中包含了 async,并且使用了 polyfill: ['async']

问题环境

xhong0 commented 4 years ago

存量解决:在 swan.config.js 中将 polyfill 改为 localPolyfill,并重新编译上传包 image

新增:我这边更新一下文档和最新cli,有进展,将更新状态

xhong0 commented 4 years ago

okam-cli 0.1.12 已发版,更新置最新, 百度小程序默认使用改为: localPolyfil