Hi, I've got this code:
class Adapter extends Array {
constructor() {
super();
console.log('Hello');
console.log('World');
}
}
new Adapter()
which is transpiled using this config:
{
"presets": [
"es2015",
"babili",
]
}
Without babili it runs just fine, but with it activated, I get following output:
World
Hello
World
The minified code look as follows:
'use strict';function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var Adapter=function(_Array){function Adapter(){_classCallCheck(this,Adapter);var _this=_possibleConstructorReturn(this,(Adapter.__proto__||Object.getPrototypeOf(Adapter)).call(this));return console.log('World'),console.log('Hello'),console.log('World'),_this}return _inherits(Adapter,_Array),Adapter}(Array);new Adapter;
The bug is in the simplify plugin.
I noticed that this doesn't happen when you don't use es2015 preset (or) when used with passPerPreset: true ...
{
"presets": [ "es2015", "babili" ],
"passPerPreset": true
}
passperpreset is enabled by default .And also, even if I disable that option from babili, it still isn't a problem.
Most helpful comment
The bug is in the simplify plugin.
I noticed that this doesn't happen when you don't use es2015 preset (or) when used with
passPerPreset: true...