Vite + Rollup production build "TS2304: Cannot find name 'WebGLObject'"

I’m in the process of trying out Vite (+ Rollup) for current projects.

It’s working great for local dev but when building for production (Vite uses Rollup for prod builds) I get the following errors:

node_modules/@babylonjs/core/Engines/engine.d.ts:1086:30 - error TS2304: Cannot find name 'WebGLObject'.
1086 interface WebGLQuery extends WebGLObject {

node_modules/@babylonjs/core/Engines/engine.d.ts:1094:32 - error TS2304: Cannot find name 'WebGLObject'.
1094 interface WebGLSampler extends WebGLObject {

node_modules/@babylonjs/core/Engines/engine.d.ts:1102:29 - error TS2304: Cannot find name 'WebGLObject'.
1102 interface WebGLSync extends WebGLObject {

node_modules/@babylonjs/core/Engines/engine.d.ts:1110:42 - error TS2304: Cannot find name 'WebGLObject'.
1110 interface WebGLTransformFeedback extends WebGLObject {

node_modules/@babylonjs/core/Engines/engine.d.ts:1118:42 - error TS2304: Cannot find name 'WebGLObject'.
1118 interface WebGLVertexArrayObject extends WebGLObject {

So far I haven’t been able to find much about it except maybe this: Opaque types for WebGL · Issue #5855 · microsoft/TypeScript · GitHub

Anyone have any ideas?

WebGLObject seems to be missing from lib.dom.d.ts

After installing webgl-strict-types the production build works.

But I’m still a little clueless why the issue … and whether my solution is OK?

WebGLObject has been removed from TS 4.3.2.

@Deltakosh has updated Babylon.js sources to remove references to this object, I think it was last week. You may not have the latest sources?


They are so annoying with those changes :frowning:


Thanks @Evgeni_Popov . I updated from Babylon.js 4.2.0 to latest preview 5.0.0-alpha.24, removed my webgl-strict-types dependency and now the production build works fine.