A Class already exists with the same

Cocostor 版本:2.4.8(其实我们用的2.4.11也出现了)
在打包完成后,在对应平台(微信小游戏,抖音,App等)上运行是会出现以下错误:

JS: A Class already exists with the same classname : “SpineCom”.
JS: A Class already exists with the same cid : “d2162Vkv0lCQYV1sS1qbL1p”.
JS: A Class already exists with the same classname : “BossBase”.
JS: A Class already exists with the same cid : “9b380MMZPlHyr9V99tREfnX”.
JS: A Class already exists with the same classname : “SpineCom”.
JS: A Class already exists with the same cid : “d2162Vkv0lCQYV1sS1qbL1p”.
JS: A Class already exists with the same classname : “BaseMonster”.
JS: A Class already exists with the same cid : “8552694hhpABrGyNNswivsM”.
JS: A Class already exists with the same classname : “BossBase”.
JS: A Class already exists with the same cid : “9b380MMZPlHyr9V99tREfnX”.
JS: A Class already exists with the same classname : “BaseMonster”.
JS: A Class already exists with the same cid : “8552694hhpABrGyNNswivsM”.
JS: A Class already exists with the same classname : “SpineCom”.
JS: A Class already exists with the same cid : “d2162Vkv0lCQYV1sS1qbL1p”.
JS: A Class already exists with the same classname : “NewRole”.
JS: A Class already exists with the same cid : “5a5acAh7I5K74CeUugn8Cia”.
JS: A Class already exists with the same classname : “MainScene”.

只会打包后运行才会有这个错误。
不是每次都出现,偶尔出现(打几次包后,就会出现一次,可能会连续出现)。
一般情况在重新构建(或者删除temp,library后再构建),本次不会出现。
正常本地开发中没有出现过。

重复加载了.
以前做热更新时候,碰到过,改了一下底层的js.unregisterclass. 你搜一下.这个问题类似的.在js.register的时候,调用一下.


我感觉这样修改就可以了吧,每次都覆盖掉之前的。
var registered = table[id];
if (registered && registered !== constructor) {
if (CC_DEV || CC_EDITOR) {
cc.warn(‘A Class already exists with the same ’ + key + ’ : "’ + id + ‘". It will be overwritten.’);
}
table[id] = constructor;
}