Babel transpiled代码不支持IE11中的静态方法 [英] Babel transpiled code does not support static methods in IE11

查看:374
本文介绍了Babel transpiled代码不支持IE11中的静态方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Babel transpiled js工作正常,但在IE11上,静态继承似乎不起作用。任何想法?

  class SuperClass {
constructor(){}

static test ){}
}

class Sub extends SuperClass {
constructor(){
super();
}
}

Sub.test(); //结果:对象不支持属性或方法'test'


解决方案

似乎Babel不处理这种情况,其实在继承帮助器中,如果 Object.setPrototypeOf 方法是 undefined ,Babel简单地将超级类附加到 __ proto __ 键。



我已经处理此问题,包括 polyfill /解决方法在这一刻,似乎工作正常,直到巴别小组不会解决这个问题。


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'

解决方案

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.

这篇关于Babel transpiled代码不支持IE11中的静态方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆