I’m trying to reduce my bundle size by importing only from absolute imports and none from ‘@babylonjs/core’.
So I’m importing Scene from ‘@babylonjs/core/scene’.
However, now I’m getting an error;
TypeError: scene.onBeforeRenderObservable.runCoroutineAsync is not a function
Everything works if I import Scene from ‘@babylonjs/core’ but that increases the bundle size almost by 2x.
its here. Babylon.js/observableCoroutine.ts at master · BabylonJS/Babylon.js · GitHub
i think the question is, do you want buggy code or 2x size bundle? without question i take the 2x bundle size.
I ultimately agree with you. It’s not my bottleneck anyways. Just got over-focused on optimizing I guess.
to ensure the side effects would “augment” your scene capabilities with the coroutines addition so growing a tiny bit the code with only the features you need.