babel polyfill 支持哪些特性?
what features does the babel polyfill support?
是否有关于 babel-polyfill 支持的功能的列表?我们刚开始使用 babel,我想知道是否可以消除我们目前依赖的某些依赖项,例如 es6-promises
& whatwg-fetch
。如果 babel-polyfill
支持 promises 当然就不需要包含 es6-promises
.
我想经过一些研究我明白了。 Babel-Polyfill is pretty much core.js + Regenerator Runtime . Look at those projects individually to see what features will be polyfilled. For example, at the time of this writing 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.
承诺:
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(没有承诺)中测试过,所以它似乎可以正常工作。
是否有关于 babel-polyfill 支持的功能的列表?我们刚开始使用 babel,我想知道是否可以消除我们目前依赖的某些依赖项,例如 es6-promises
& whatwg-fetch
。如果 babel-polyfill
支持 promises 当然就不需要包含 es6-promises
.
我想经过一些研究我明白了。 Babel-Polyfill is pretty much core.js + Regenerator Runtime . Look at those projects individually to see what features will be polyfilled. For example, at the time of this writing 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.
承诺:
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(没有承诺)中测试过,所以它似乎可以正常工作。