cx20
October 27, 2025, 8:44pm
1
I haven’t checked everything yet, but it seems some official samples have stopped working.
There are likely more, but here are the ones I’ve found so far.
Among the samples on https://doc.babylonjs.com/addons/htmlMesh, the following produce runtime errors:
https://playground.babylonjs.com/#HVHYJC#5
https://playground.babylonjs.com/#B17TC7#112
On https://doc.babylonjs.com/setup/support/webGL2/, the following produces a runtime error:
https://playground.babylonjs.com/#QDAZ80#3
cx20:
QDAZ80
All fixed! Should be live in less than 10minutes
Thanks a ton @cx20 !
1 Like
cx20
October 27, 2025, 9:23pm
4
I think there are other samples that aren’t working yet, but I’m feeling sleepy, so I’ll stop here for today.
https://doc.babylonjs.com/toolsAndResources/utilities/Frame/
https://playground.babylonjs.com/#ZGVYNB
https://playground.babylonjs.com/#ZGVYNB#1
https://playground.babylonjs.com/#ZGVYNB#2
https://doc.babylonjs.com/toolsAndResources/utilities/InnerMeshPoints/
https://playground.babylonjs.com/#2K3T61#8
https://playground.babylonjs.com/#2K3T61#2
https://playground.babylonjs.com/#2K3T61#7
https://doc.babylonjs.com/toolsAndResources/utilities/Line2D/
https://playground.babylonjs.com/#FA2H7X#3
https://playground.babylonjs.com/#FA2H7X#4
https://playground.babylonjs.com/#FA2H7X#5
https://playground.babylonjs.com/#FA2H7X#6
https://playground.babylonjs.com/#9MYFC2
https://playground.babylonjs.com/#9MYFC2#1
https://playground.babylonjs.com/#0RIS0M
https://playground.babylonjs.com/#0RIS0M#1
https://playground.babylonjs.com/#0RIS0M#2
https://playground.babylonjs.com/#0RIS0M#3
https://playground.babylonjs.com/#S7HM64
https://playground.babylonjs.com/#S7HM64#1
https://playground.babylonjs.com/#S7HM64#2
https://playground.babylonjs.com/#S7HM64#3
https://playground.babylonjs.com/#FA2H7X#18
cc @knervous
Here the issue: the PG does not accept anymore undeclared variables where before it was ok.
Do you know how to turn that behavior back on?
I will take a look asap latest tomorrow morning and will have something put together, thanks for the ping!
2 Likes
Got a PR up to address all of these cases I think. JS really can be the wild west sometimes. Should cover all the cases from these links you posted here which cover undeclared variables and this access.
master ← knervous:master
opened 08:19PM - 28 Oct 25 UTC
1. Snippet session state.
- This is on automatically and mirrors some of what V… S Code does. IMO it is a good default behavior that shouldn't need to be behind a config flag because if you're working on a PG and have 5 of the files open and refresh the page, you want all those 5 files open still, and to jump back to the active file where the cursor was on your last edit - that's what this PR does.
2. Error handling logic for older Playgrounds
- This was a bit of a doozy. Older JS engines were quite flexible with a lot of things around variable assignment and scoping, same with the eval JIT JS compiler. Not the case in ES modules, but we do get nice consistent errors when these things happen. This is addressing two issue I saw through examples in the PG:
- Undefined variables being accessed from RHS. This is like having the line `path = [1,2,3];`. In modern JS, you need to write `var`, `let` or `const` otherwise the compiler will throw. That error is exactly what we can catch and iteratively assign global variables so that it *is* accessible and spits a warning out in the console. Not a pretty solution but don't think there is one.
- `this` accessing closure or global namespace, I understand people's confusion and frustration with JS from 10 years ago when these sorts of things are allowed to happen:
```js
var scene = new BABYLON.Scene(engine);
// Camera
camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 0, -10), this.scene);
// We get a double-whammy here - no variable declaration and accessing `this` which doesn't exist without caller context.
```
- Solution to bind a calling context of a proxy and map the result and known babylon "instance globals" just to stop the runtime from complaining, but not as a feature.
2 Likes