" class constructors must be invoked with 'new' "

Hi,
I’m getting this issue when using SVGLoader.js AND other sub libraries.
i get the message :
"“class constructors must be invoked with ‘new’”.
All I’m getting in research for this message is C++ posts.
Is ANYONE else getting this with the newest (possibly next to last newest revision of three?)
I HAVE to solve this issue. there’s just NO answers for it out there that help!
Thanks!

This would suggest that the other libraries you’re using were written for an older version of three.js. Most of the classes provided by three.js (Mesh, Object3D, etc.) are now ES6 Classes instead of prototype objects (see Eloquent JavaScript Ch. 6), and this means that any third-party code that extends these classes must now be converted from prototype objects to ES6 Classes as well. These ES6 Class conversions began around r120, I’m not sure at which version they completed.

I did a conversion to update the A-Frame Inspector for ES6 Classes recently – see Updates to support recent three.js/a-frame use of ES6 classes. by donmccurdy · Pull Request #627 · aframevr/aframe-inspector · GitHub. The third-party libraries you’re using may need similar updates.

2 Likes

Thank you for that information.
I’ve updated ( though I thought I had) and things seem to be working.
I initially thought that was the issue, and had done so… a second try fixed it. but thanks for the detailed info on the message.
Cheers!