Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

BabylonJS + Webpack

$
0
0

Hi,

 

I just switched to webpack in one of my babylon.js projects and found a few oddities:

 

1. src version as "main" in package.json

 

This is not only webpack related. As far as I am aware libraries should not refer to a minimized version here. Browserify, webpack and the likes will do minification if desired. I couldn't find the package.json in the git repository. Would have created a pull request but it doesn't seem to be there :o

 

2. "use strict";

 

As my project is ES2015 I am using babel to transpile it back to es5. During this process babel will prepend a "use strict" to every script (for whatever reason ;) ). I am cloning a few meshes in my project and I think it found a possible bug there:

 

Uncaught (in promise) TypeError: Cannot set property hasLODLevels of #<r> which has only a getter
    at Function.r.DeepCopy (http://localhost:8080/output.js:20748:93937)
 
The problem here is that DeepCopy will iterate over all properties and copy the value to the cloned mesh. This includes all the properties defined via Object.defineProperty :o However they are getters only and thus it throws an error here. That makes perfect sense. Maybe babylon.js should always include "use strict"?  Maybe there are more potential bugs hiding out there ;)
 
Currently I am just ignoring babylon.js while building.

Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>