Hi everyone,
I have a project on Angular & Electron, and I’d like to integrate Three.js for a little bit of 3D image overlay.
I first updated my project to the latest Angular (8.2) then installed Three.js using npm install three
.
The issue is that when calling import * as THREE from 'three';
in my code, and running ng serve
or launching Electron, I get the following error message:
ERROR in ../node_modules/three/src/renderers/webgl/WebGLUtils.d.ts:3:43 - error TS2304: Cannot find name 'WebGL2RenderingContext'.
I tried installing @types/three
and @types/webgl2
, but none of them seem to solve the issue.
I also cloned this repo that shows an Angular project working with Three.js, I can run it perfectly fine, but I can’t see what the issue is on my project…
I know it’s probably a dumb solution that I didn’t think about (some declaration somewhere), but I can’t seem to find it…
Here is the link to my repo
To reproduce:
- clone the repo,
- go to CVERT-ng folder,
-
npm i
, npm i three
- add
import * as THREE from 'three';
in any .ts file (.service.ts or .component.ts), - serve or run electon:
ng serve
ornpm run electron
Any help would be VERY much appreciated !..
Thank you very much in advance !!!