Babylon.js and babylon.max.js compiled in ES6

Hi,

I was wondering why Babylon is compiling in ES5 and not so in ES6 with class {}

I suppose it would reduce the weight of the file babylon.js and babylon.max.js

This would also increase the speed of code execution by the interpreter and reduce the memory stoker with local variables. because with ES5 all the variables, function are global.

By and large the use of prototypes in Javascript is over old.

It’s just a question from Babylon’s modernity, the code should also be with modern Javascript (ES6) that all modern browsers support (Chrome, Firefox, Opera …)

It should not change anything at the level of use.

I actually think there was a discussion about this before, like a while back. Ill see if I cant dig that back up.

WHATS UP DAD? LONG TIME NO SEE!

Nothing new, nothing about programming. I do a lot of work at home right now. A house is never finished.

We do have have both actually :slight_smile:
ES5 and ES6

babylon.max.js is kept with ES5 for backward compatibily

You can find ES6 version here: @babylonjs/core - npm

https://doc.babylonjs.com/features/es6_support

1 Like

Yes but it is in package form.
I thought of something like this :

<script src="babylonES6.js"></script>

rather that :

import { Engine } from "@babylonjs/core/Engines/engine";
import { Scene } from "@babylonjs/core/scene";
...

I’m not very comfortable with NPM. I have not yet understood the import/exports in ES6

you can run npm install @babylonjs/core and then go into node_modules to just get the compiled files

1 Like

Yes but I do not know how and where to run “npm install @babylonjs/core”.
This is not too serious, I will continue to use as before.

just install Node and then from any cmd line it should work

Ah OK. I should know how to do it. I saw this differently.

Thank you DK

1 Like