ES6 Proxy Polyfill for IE11

后端 未结 3 926
你的背包
你的背包 2020-12-15 04:02

IE11 does not and will not implement ES2015 Proxy objects. Yet IE11\'s end of extended support is October 14, 2025.

Is there any way to polyfill Proxy objects for IE

3条回答
  •  没有蜡笔的小新
    2020-12-15 04:25

    Direct solution for polyfilling ES6 Proxy in environments without support this feature, of course is impossible - if storing some polyfill function info window.Proxy is meant. But if thinking this way, most modern features of ES6 can't be supported, because they will raise syntax error for old-version ECMAScript engine.

    That's why you should use transpiler, which perform preceding wrapping ES6 code into specific constructions, and then evaluate transformed code on old engine. In current case, just use one Babel plugin: https://www.npmjs.com/package/babel-plugin-proxy

    Of course, while using this solution, you should configure Webpack to segregate target bundles for different client agents / browsers, depending on it's feature set discovery. See details here: https://gist.github.com/newyankeecodeshop/79f3e1348a09583faf62ed55b58d09d9

提交回复
热议问题