Closed JackDra closed 1 year ago
Hi @JackDra, have you import three.js
in your project? Without it, the ThreeRendererBridge
will fail to create the context. Perhaps the following code will do you some help:
import * as THREE from 'three';
import { Kekule } from 'kekule';
Kekule.externalResourceManager.register('three.js', THREE);
Hi @JackDra, have you import
three.js
in your project? Without it, theThreeRendererBridge
will fail to create the context. Perhaps the following code will do you some help:import * as THREE from 'three'; import { Kekule } from 'kekule'; Kekule.externalResourceManager.register('three.js', THREE);
That did the trick.
I think there was an older version that was doing some kind of hack with:
// This is the trick for using Kekule 3D renderer
// THREE is defined as a component in Window object by kekule
window["THREE"] = THREE;
But replacing it with the register method worked. Thanks!
Our app needed to update from webpack 4 to vite, and I am having trouble trying to get Kekule imported into our application.
Any import Kekule (version 1.0.0) is throwing the exception:
I can fix the import by modifying this line https://github.com/partridgejiang/Kekule.js/blob/153e75b46379f4aba99ce5129ffdf96a1625b9b2/src/kekule.moduleEnvInits.cm.js#L30 to be:
so that it can be parsed by
URL
. But after doing this, the 3D viewer fails when painting:failing lines:
Where initialized:
Traceback: