Class 在新的 THREE.CSS2DObject 中没有 'new' 就无法调用构造函数 Object3D

Class constructor Object3D cannot be invoked without 'new' at new THREE.CSS2DObject

我收到这个错误: 未捕获的类型错误:Class 没有 'new' 就无法调用构造函数 Object3D 在新的 THREE.CSS2DObject 我尝试 运行 这个项目: https://github.com/vasturiano/3d-force-graph/blob/master/example/text-nodes/index.html

此错误表明 THREE.CSS2DObject 和核心库 three.js 来自不同的版本。不支持此类设置,应始终避免。

请注意,最近代码库已迁移到 ES6 classes。如果您尝试从 ES6 class 派生出具有 ES5 原型样式的代码,您将遇到上述运行时错误。所以看起来代码使用了比 THREE.CSS2DObject.

更新的 three.js