ES6 version incoming

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.

1 Like

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

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

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.

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'
        })
    ]
}

@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.”

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

1 Like

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

1 Like

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)

1 Like

That is a GOOOD news! Thanks for reporting back!

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

1 Like

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:

1 Like

Sweet, thanks for sharing :slight_smile:

Love to see that es6 has moved a lot forward :).

Any reason why the @babylonjs packages are a bit behind version wise ?

they are not:

Oups yes. Thanks !

The npm update was working on the babylonjs packages but not on @babylonjs. I updated the version manually and it works :slight_smile:

yeah we flagged the first release (alpha18) as stable so that may be why

1 Like

Actually the first is release is automatically flagged as stable despite being an alpha so that if ppl install they got something :slight_smile:

I think we should just release as @latest for all @babylonjs/*
Otherwise people will get the old alpha.

then when we release 4.0.0 we can start tagging the new releases as @next since that seems to be what most frameworks do.

We could setup a CI to automatically do a @dev release also, that could mirror the master branch.

So:

@latest = latest semver release
@next = 4.1.0-beta
@dev = 4.1.0-dev.master-dc36dbc (where the last bit is the sha1 git hash)

That way we can always force install a specific version to test if a bug is present.
But also for some of us that are on the bleeding edge, can install the latest build.

Some might say that you should install the @dev builds directly from github, but since that doesn’t contain our builds, thats a no go.

I recently helped angular @ngxs to do something like this using circle ci.
So if you need any help with setting up a CI server I could be of assistance.

We thought about @dev with @Deltakosh and we are afraid to bloat the versions as the number of push to master is pretty high. CI would not be an issue as we already have the gulp and npm publishing automated scripts.

About @latest, we are relying on @next, as we were using @preview on the babylonjs packages I wanted to stay consistent with those in versioning. That said would be easy to change as well. I even wonder if I could push both tags :slight_smile:

@Deltakosh I let you weight in but all would be easy on our side (aside the double tag as I have no idea if it could work), I have no pref at all, the easier for the community the better :slight_smile: