问题在于该类扩展了本机ES6类,并通过Babel转换为ES5。转译的类至少在没有其他措施的情况下不能扩展本机类。
class TranspiledFoo extends NativeBar { constructor() { super(); }}导致类似
function TranspiledFoo() { var _this = NativeBar.call(this) || this; return _this;}// prototypically inherit from NativeBar由于ES6类应该只调用
new,
NativeBar.call在错误的结果。
ES6类在任何最新的Node版本中均受支持,不应进行编译。
es2015应该从Babel配置中排除,最好使用
env预设设置为
nodetarget。



