Babel 转译后的代码在 IE11 中不支持静态方法
Babel transpiled code does not support static methods in IE11
Babel transpiled js 工作正常,但在 IE11 上静态继承似乎不起作用。有什么想法吗?
class SuperClass {
constructor () {}
static test () {}
}
class Sub extends SuperClass {
constructor () {
super();
}
}
Sub.test(); //Results in: "Object doesn't support property or method 'test'
Babel 好像没有处理这种情况,实际上在inherits
helper 中,如果Object.setPrototypeOf
方法是undefined
,Babel 只是附加了super class 到 __proto__
键。
我已经解决了这个问题,包括这个 polyfill/workaround 在。目前,它似乎工作正常,直到 Babel 团队不会修复此行为。
Babel transpiled js 工作正常,但在 IE11 上静态继承似乎不起作用。有什么想法吗?
class SuperClass {
constructor () {}
static test () {}
}
class Sub extends SuperClass {
constructor () {
super();
}
}
Sub.test(); //Results in: "Object doesn't support property or method 'test'
Babel 好像没有处理这种情况,实际上在inherits
helper 中,如果Object.setPrototypeOf
方法是undefined
,Babel 只是附加了super class 到 __proto__
键。
我已经解决了这个问题,包括这个 polyfill/workaround 在。目前,它似乎工作正常,直到 Babel 团队不会修复此行为。