[LayaNative 2.0]Laya 2.2.0 只支持编译 target 为 es6的相关问题
引擎版本: Laya 2.2.0
语言: typescript
构建方式:
{
"compilerOptions": {
"module": "es2015",
"lib": [
"es2015",
"es6",
"dom"
],
"target": "es6",
"noEmitHelpers": false,
"sourceMap": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
".laya",
".rpt2_cache"
]
平台:微信小游戏
es6中的 async/await 编译 es6时会被翻译成 yield 和 function*() 的实现方式
yield function*() 导致真机黑屏,开发者工具没问题。
laya2.2.0 只支持 es6 的 target 编译, 如果改为 target 为 es 编译,会出现 Class constructor XXX cannot be invoked without 'new'。
真机黑屏查了4个小时才查到原因,花了1个多小时改代码(之前很多地方都使用的 async/await ,而且全部改为 promise,没有 async/await 可读性以及维护性强)
相关参考见:
https://developer.mozilla.org/ ... yield
https://github.com/basarat/typ ... it.md
希望官方可以在后续版本仍然支持 es5 的 target 编译。
另外:OES_texture_half_float的 wegbl1 的特性,在华为麦芒机器上 会报错
见截图:
语言: typescript
构建方式:
{
"compilerOptions": {
"module": "es2015",
"lib": [
"es2015",
"es6",
"dom"
],
"target": "es6",
"noEmitHelpers": false,
"sourceMap": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
".laya",
".rpt2_cache"
]
平台:微信小游戏
es6中的 async/await 编译 es6时会被翻译成 yield 和 function*() 的实现方式
yield function*() 导致真机黑屏,开发者工具没问题。
laya2.2.0 只支持 es6 的 target 编译, 如果改为 target 为 es 编译,会出现 Class constructor XXX cannot be invoked without 'new'。
真机黑屏查了4个小时才查到原因,花了1个多小时改代码(之前很多地方都使用的 async/await ,而且全部改为 promise,没有 async/await 可读性以及维护性强)
相关参考见:
https://developer.mozilla.org/ ... yield
https://github.com/basarat/typ ... it.md
希望官方可以在后续版本仍然支持 es5 的 target 编译。
另外:OES_texture_half_float的 wegbl1 的特性,在华为麦芒机器上 会报错
见截图:
要回复问题请先登录
1 个回复
186*****810
赞同来自: