We at the three.js team try move our code base to ES6 classes and want to use Bublé to generate ES2015 code. When inspecting the output, we noticed that Bublé produces a closure around class definitions iff the class is inherited from another one. Consider this (stripped-down) code:
class BoxGeometry extends Geometry {
constructor( width, height, depth, widthSegments, heightSegments, depthSegments ) {
super();
this.type = 'BoxGeometry';
}
}
Bublé produces:
var BoxGeometry = /*@__PURE__*/(function (Geometry) {
function BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) {
Geometry.call(this);
this.type = 'BoxGeometry';
}
if ( Geometry ) BoxGeometry.__proto__ = Geometry;
BoxGeometry.prototype = Object.create( Geometry && Geometry.prototype );
BoxGeometry.prototype.constructor = BoxGeometry;
return BoxGeometry;
}(Geometry));
Is there a way to avoid the closure around BoxGeometry (see mrdoob/three.js#17276 (comment))?
We at the
three.jsteam try move our code base to ES6 classes and want to use Bublé to generate ES2015 code. When inspecting the output, we noticed that Bublé produces a closure around class definitions iff the class is inherited from another one. Consider this (stripped-down) code:Bublé produces:
Is there a way to avoid the closure around
BoxGeometry(see mrdoob/three.js#17276 (comment))?