[LayaNative 2.0]微信小游戏调试报错window is not defined

使用官方的2D项目发布为微信小游戏后,扫码预览和真机调试,在game.js中都会报错:
gameThirdScriptError
Uncaught ReferenceError: window is not defined
ReferenceError: window is not defined
at https://servicewechat.qq.com/game.js:63771:12
at require (<anonymous>:3:7977)
at https://servicewechat.qq.com/game.js:63777:10
 
请问如何解决?官方的DEMO都有问题吗?
已邀请:

Chaplin

赞同来自:

wxxyx.jpg

在game.js开头加入
var window = window || global;
var document = document || (window.document = {});
然后报这个错了,index.js都无法载入。

Chaplin

赞同来自:

demo见附件

半生回忆

赞同来自:

import "weapp-adapter.js";

Baez

赞同来自:

可以先手动改一下game.js详情看这里  https://ask.layabox.com/question/40289

腊笔小新

赞同来自:

大家以后一定要上传DEMO!

要回复问题请先

商务合作
商务合作