问题
Babel transpiled js works fine, but on IE11 the static inheritance seems not to work. Any idea?
class SuperClass {
constructor () {}
static test () {}
}
class Sub extends SuperClass {
constructor () {
super();
}
}
Sub.test(); //Results in: "Object doesn't support property or method 'test'
回答1:
It seems that Babel does not handle the case, in fact in the inherits
helper, if the Object.setPrototypeOf
method is undefined
, Babel simply attaches the super class to the __proto__
key.
I have managed this issue including this polyfill/workaround at the. At the moment, it seems to work fine, until the Babel team won't fix this behavior.
来源:https://stackoverflow.com/questions/34183086/babel-transpiled-code-does-not-support-static-methods-in-ie11