Babylonjs Magento 2.x ES6

Hi everybody. It’s me the Magento guy again :grinning_face: .

I have incorporated babylonjs into Magneto 2.x for some time now. However when using the latest versions of Babylonjs such as ver. 8.x, I am getting lagging issues when navigating the playground and delay violation errors in the browser console. I am pretty confident that the problem has to do with the large files size of babylonjs (>8MB).

So I looked into the option of using ES6 babylonjs and import only the modules that I use, but Magento 2 does not natively support ES6. There is a recommendation to use BABEL transpiler but I guess that would convert the babylonjs code back to UMD as a large single file.

Has anybody any idea how can I overcome this issue?

cc @RaananW

Hey,

that’s an interesting issue :slight_smile:
I would personally generate an external project bundled with webpack (for great umd support) and generate a smaller package size. So you have a project using es6, but you produce a single js file that is magento 2.x friendly.

So you mean to use Webpack to bundle babylonjs es6?

yep, that would be my suggested solution for your scenario