creator 2.2.0 警告"Failed to construct a dummy instance of the "xxx" class"

游戏启动后自己写的所有组建都会报这个警告,不知道该如何解决

Simulator: JS: [WARN]: Failed to construct a dummy instance of the “xxx” class using new behind the scenes. This is for getting default values declared in TypeScript. Please ensure the class will be able to construct during script’s initialization. TypeError: Cannot read property ‘enableForTarget’ of null.

你的new操作的代码放到哪里了?最好放在组件的 onload 里面操作
https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html

没有什么new操作啊,这些组件都是通过creator中"添加组件"的方式关联到场景中的某个节点的。

给下demo吧,帮你看看~

我也遇到了,请问怎么解决?我是从2.2.2升级到2.3的时候出现警告的

可能是import出来的对象不是类,没有构造函数,远程调试下,看下是哪个对象初始化报错,跟踪下来至哪个源文件。

我也遇到了,creator版本是2.1.3