ES6 Create Mesh

What is the equivalent of this in ES6?

var customMesh = new BABYLON.Mesh("custom", scene);

Hey @ankyankyanky it’s:

import { Mesh } from "@babylonjs/core/Meshes"

var customMesh = new Mesh("custom", scene);

Good luck !

If you have VSCode, it has autocomplete on module imports which makes it very handy for finding the specific import.

If you cant/don’t want to find it, you can also import it like this:

import { Mesh } from "@babylonjs/core"

This will increase your bundle size however instead of doing specific imports. You can find a lot more detailed info about this here: Babylon.js ES6 support with Tree Shaking | Babylon.js Documentation

3 Likes

@br-matt Thanks