收藏
回答

关于cocos构建包至微信开发工具中报MutationObserver相关错误?

MutationObserver

微信开发者工具基础库2.28.0

windows11

报错信息:

ReferenceError: MutationObserver is not defined

    at bundle.js:11

    at bundle.js:11

    at r.e._load (bundle.js:5)

    at r.e._tryModuleLoad (bundle.js:5)

    at r.e._require (bundle.js:5)

    at r.e.require (bundle.js:5)

    at Object.execute (bundle.js:18)

    at i (system.bundle.js:1)

    at E (system.bundle.js:1)

    at system.bundle.js:1(env: Windows,mg,1.06.2210310; lib: 2.28.0)

(anonymous) @ game.js? [sm]:80

Promise.catch (async)

__initApp @ game.js? [sm]:66

(anonymous) @ game.js? [sm]:111

O @ VM347 WAGameSubContext.js:1

(anonymous) @ VM419:1

doWhenAllScriptLoaded @ game.js:40

(anonymous) @ game.js:14

t.onload @ VM345:10

load (async)

c @ VM345:10

window.loadBabelMod @ VM345:10

(anonymous) @ bundle.js:2

想请教一下这个问题是什么原因导致的?在开发者工具中编译时会有cocos自带的进度条,当这个进度条加载完成时就会报出这个问题使代码无法执行下去,没有执行到我的项目代码,本身项目中也并没有用到各种服务器、在线的内容也没有做检测等功能。npm构建都已完成,在脚本中找到

if (!(e && e.supports && e.supports("modulepreload"))) { for (var t, n = p(document.querySelectorAll('link[rel="modulepreload"]')); !(t = n()).done;) { r(t.value) } new MutationObserver((function (e) { for (var t, n = p(e); !(t = n()).done;) { var o = t.value; if ("childList" === o.type) for (var a, i = p(o.addedNodes); !(a = i()).done;) 

该处构造函数时报出未定义,但是项目中存在该接口

回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容