gpt4 book ai didi

babeljs - babel polyfill 支持哪些功能?

转载 作者:行者123 更新时间:2023-12-02 17:03:53 24 4
gpt4 key购买 nike

是否有 babel-polyfill 支持的功能的任何类型的列表?我们刚刚开始使用 babel,我想知道我们当前依赖的一些依赖项是否可以被消除,例如 es6-promises 和 Whatwg-fetch 。如果 babel-polyfill 支持 Promise,当然就不需要包含 es6-promises。

最佳答案

我想经过一番研究后我明白了。 Babel-Polyfill几乎是core.js + Regenerator Runtime 。单独查看这些项目,看看哪些功能将被填充。例如,在撰写本文时 core.js :

获取:

window.fetch is not a cross-platform feature, in some environments it makes no sense. For this reason, I don't think it should be in core-js. Looking at a large number of requests it may be added in the future. Now you can use, for example, this polyfill.

promise :

Modular standard library for JavaScript. Includes polyfills for ECMAScript 5, ECMAScript 6: promises, symbols, collections, iterators, typed arrays, ECMAScript 7+ proposals, setImmediate, etc.

所以我需要 whatwg-fetch 但我不需要 es6-promises。在 IE11(没有 promise )中进行了测试,因此它似乎可以正常工作。

关于babeljs - babel polyfill 支持哪些功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38439590/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com