From Vite/typescript (development environment) to playground

Hi all, I’ve successfully install vite with typescript and now I can test my project with hot reload! Wow! But I’m a newbie and my code is far from good…therefore I’d like to know the best (and easy) way to port my code to the playground (for your wonderful help :slight_smile: ).
Thanks in advance
Frank

There’s almost no difference! You can try

In the playground I found you have to declare all your types with BABYLON.SomeBabylonType, or at least I couldn’t easily figure out how to avoid doing that.

Another thing is your assets have to be hosted somewhere since you can’t load a local asset. I hosted using github following this guide:
https://doc.babylonjs.com/toolsAndResources/thePlayground/externalPGAssets

Hi all, I’ve set my development environment as best as possible (I think, using Vite and ES6), and now I can copy/paste the code (to test) to babylon playground. Like Snowden said, apart for standard Babylon call, I’ve to manually insert “BABYLON” before the methods that belong to other categories (example: @babylon/materials → skymaterial).
To avoid these manual changes,there is a way to group the ES6 distinct used categories (loaders, materials, core, etc…) into a single voice (namespace?) BABYLON?
Thanks

PS: I’ve read that this ecosystem, “development code/playground” will be soon improved, right?

One way to do this is to use the deconstructed syntax of js in the playground, but this may not be appropriate in all cases.

Example

const { Scene, Vector3 } = BABYLON
// equivalent ↓
import { Scene, Vector3 } from "@babylonjs/core"
2 Likes