Closed qianliu013 closed 4 years ago
百度小程序近期上线了非兼容性改动,这将导致无法在小程序中获取全局变量(如通过 window/root/global/Function('return this')() 等), 使得无法将一些属性挂载在全局变量,从而导致小程序运行异常。
Function('return this')()
典型的例子:使用了 async,编译后的代码运行会往全局变量挂载 regeneratorRuntime 属性。
对于 Okam 的影响:如果使用了 polyfill: ['async'](目前的 swan.config.js 默认配置), 请在 swan.config.js 中将 polyfill 改为 localPolyfill,并重新编译上传包
polyfill: ['async']
代码中包含了 async,并且使用了 polyfill: ['async']
okam-cli
存量解决:在 swan.config.js 中将 polyfill 改为 localPolyfill,并重新编译上传包
新增:我这边更新一下文档和最新cli,有进展,将更新状态
okam-cli 0.1.12 已发版,更新置最新, 百度小程序默认使用改为: localPolyfil
localPolyfil
问题类型
问题详情
百度小程序近期上线了非兼容性改动,这将导致无法在小程序中获取全局变量(如通过 window/root/global/
Function('return this')()
等), 使得无法将一些属性挂载在全局变量,从而导致小程序运行异常。典型的例子:使用了 async,编译后的代码运行会往全局变量挂载 regeneratorRuntime 属性。
对于 Okam 的影响:如果使用了
polyfill: ['async']
(目前的 swan.config.js 默认配置), 请在 swan.config.js 中将 polyfill 改为 localPolyfill,并重新编译上传包期望效果
实际情况
复现步骤 和 问题示例
代码中包含了 async,并且使用了
polyfill: ['async']
问题环境
okam-cli
0.1.11