# Creating a local es6 compatible build?

**URL:** <https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245>\
**Category:** Questions\
**Created:** [March 30, 2019, 2:54pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245 "2019-03-30T14:54:03Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 30, 2019, 2:54pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/1 "2019-03-30T14:54:03Z")

</div>

I’m looking for a way to build the es6 version of babylon. I tried it with the publish tool (node ./index.js in the tools/publisher folder), which seemingly creates the umd version successfully, but fails at the es6 version with:

> Error: ENOENT: no such file or directory, lstat ‘C:\Users\Mauri\Desktop\projekte\sscjs\Babylon.js.temp\distES6\core’

Any idea how to solve that? (I already ran gulp typescript-libraries) before the publisher

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 30, 2019, 6:40pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/2 "2019-03-30T18:40:50Z")

</div>

Seems like one needs to at least do a

> gulp typescript-all

for the es6 parts to build. Doing that however threw an error too, so I ran just

> gulp

which takes quite some time, but builds the es6 parts I wanted to have

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 31, 2019, 1:05am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/3 "2019-03-31T01:05:09Z")

</div>

Ok that doesn’t work, the build seems to be broken somehow.  
Somehow variable scope works strange. For example I can’t load the gltf plugin through the standard side effect method. The Gltf-loader attaches itself to the SceneLoader by calling it’s registerPlugin() method. This method adds the loader to the static class variable \_registeredPlugins. This static variable should normally be the same everywhere. But somehow even though the side effect definitely gets executed, the \_registeredPlugins variable does still not contain the gltf loader in the scope of my main file from which I did the import.  
Additionally the PhysicsEngine monkey patches the AbstractMesh class which is also broken in my build.

Any Idea what I could be doing wrong?

---

<div class="post-metadata">

**Author:** ![Galen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/galen/32/539_2.png) [@Galen](https://forum.babylonjs.com/u/Galen)\
**Post date:** [March 31, 2019, 9:36am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/4 "2019-03-31T09:36:16Z")

</div>

@mauricedoepke -

I don’t know what editor you’re using as a dev tool to write code and for compliance. I personally like Atom - it’s open source and has practically every compliance and development environment you’d ever want available. Using Atom, simply highlight your code and with one keyboard shortcut, you have ES6 compliance without having to figure out anything further.

The only issue is that it’s easy to become lazy; so I recommend writing everything in ES6 moving forward. In my opinion it’s been supported long enough now, that every browser I currently use is ES6 compliant. I’ll be curious to hear if there are any other opinions on the forum. It’s not spoken of much and needs to be covered; as I know there’s allot of new developers who aren’t familiar with ES6 and should be by now.

Galen

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mauricedoepke/32/1360_2.png) [@mauricedoepke](https://forum.babylonjs.com/u/mauricedoepke)\
**Post date:** [March 31, 2019, 5:03pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/5 "2019-03-31T17:03:59Z")

</div>

@Galen  
I think I was not clear enough. My question is how to build the babylonjs library from the github repository as es6 compatible version. The master contains fixes that are not yet published on npm. Babylon can be build as umd and since recently as es6 compatible version. But the es6 version has the problems I explained above. The npm version works fine, so I must be doing something wrong during the build  
My own codebase is written in typescript.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 31, 2019, 9:52pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/6 "2019-03-31T21:52:14Z")

</div>

Just run “npm run build” to get the fulllll build process 😃 (including es6 build)

---

<div class="post-metadata">

**Author:** ![AbUser](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@AbUser](https://forum.babylonjs.com/u/AbUser)\
**Post date:** [February 17, 2020, 7:23pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/7 "2020-02-17T19:23:09Z")

</div>

Yeah but that takes like 5 years. Is there a faster way?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 17, 2020, 9:08pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/8 "2020-02-17T21:08:41Z")

</div>

`gulp typescript-es6` will build the es6 libs only.  
`gulp [module]-es6` will build a specific module (loaders, inspector, core, etc’)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 17, 2020, 9:10pm UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/9 "2020-02-17T21:10:00Z")

</div>

> [@AbUser](#):
>
> Yeah but that takes like 5 years.

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/4907fb111eeb6b9b7b3271425f4bf7c3fe4650db.png)

---

<div class="post-metadata">

**Author:** ![AbUser](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@AbUser](https://forum.babylonjs.com/u/AbUser)\
**Post date:** [February 18, 2020, 7:46am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/10 "2020-02-18T07:46:28Z")

</div>

If your build fails add this to the command: `--max-old-space-size=8192`

---

<div class="post-metadata">

**Author:** ![jerome](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jerome/32/22_2.png) [@jerome](https://forum.babylonjs.com/u/jerome)\
**Post date:** [February 18, 2020, 7:49am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/11 "2020-02-18T07:49:44Z")

</div>

Is the Es6 build available in the preview dist folder on github ?

> **[BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview%20release)**
>
> Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework. - BabylonJS/Babylon.js

  
I can’t see where or what it is

---

<div class="post-metadata">

**Author:** ![AbUser](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@AbUser](https://forum.babylonjs.com/u/AbUser)\
**Post date:** [February 18, 2020, 7:52am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/13 "2020-02-18T07:52:14Z")

</div>

> I can’t see where or what it is

It goes here `.temp\distES6`

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 18, 2020, 7:53am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/14 "2020-02-18T07:53:06Z")

</div>

and then published to npm. we don’t publish it on github

---

<div class="post-metadata">

**Author:** ![jerome](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jerome/32/22_2.png) [@jerome](https://forum.babylonjs.com/u/jerome)\
**Post date:** [February 18, 2020, 7:54am UTC](https://forum.babylonjs.com/t/creating-a-local-es6-compatible-build/2245/15 "2020-02-18T07:54:39Z")

</div>

Ok.  
I thought there were a downloadable version for people wanting to not use npm, but just the final build.
