ES6 version incoming


#21

The packages are all deployed here: Babylon.js Documentation

They currently do not list their side effects so you need to create imports targetting modules and not the index files to benefit from tree shaking. we are currently hard working to list the side effects and enhance the discovery.


#22

Congrats, Bavs! A truly marvelous accomplishment… seriously. (hug)


#23

@sebavan I’m getting a “ReferenceError: earcut is not defined at new PolygonMeshBuilder” any idea?


#24

You either need to define earcut as a var in webpack or you can import earcut and pass it to the constructor of the PolygonMeshBuilder iin the 4th parameter. I ll add some part in the documentation for this today.


#25

so either:

import * as MyEarcut from "earcut";
...
new PolygonMeshBuilder("polytri", corners, scene, MyEarcut);

or in your webpack config:

module.exports = {
    context: __dirname,
...
    plugins: [
        new webpack.ProvidePlugin({
            'earcut': 'earcut'
        })
    ]
}

#26

@sebavan thanks a lot, found it.
the problem is that I’m using MeshBuilder.CreatePolygon which doesn’t pass the earcut parameter to `PolygonMeshBuilder.
I’ll open an issue.

btw you have a typo in the docs “Please not that you can not mix ES6 and our legacy packages.”


#27

Finally! from 500kb gzip to 150kb gzip!
70% less!


#28

YEAAHHHHHH pretty happy and thanks for your feedbacks it helps a lot ensuring the full stability in 4.0 :slight_smile:


#29

Deployed “@babylonjs/core@4.0.0-alpha.18” and “@babylonjs/gui@^4.0.0-alpha.18” to production env already. besides the issues I already opened everything works perfectly!
major improvement in loading times, thanks. (which was one of our challenges)


#30

That is a GOOOD news! Thanks for reporting back!


#31

Typo fixed and 19 is out. the earcut injection is here Allow earcut injection through meshbuilder methods · BabylonJS/Babylon.js@3e27bcb · GitHub and will be available in alpha 20


#32

I’ve tested the new alpha in both angular and react, and all typings work out of the box, and the bundle size is way down, so awesome job with the modernization :slight_smile:


#33

Sweet, thanks for sharing :slight_smile: