@babel/polyfill
🚨 As of Babel 7.4.0, this package has been deprecated in favor of directly including core-js/stable
(to polyfill ECMAScript features) and regenerator-runtime/runtime
(needed to use transpiled generator functions):
import "core-js/stable";
import "regenerator-runtime/runtime";
已经被淘汰了
Babel includes a polyfill that includes a custom regenerator runtime and core-js.
This will emulate模仿,仿真 a full ES2015+ environment (no < Stage 4 proposals提议) and is intended to be used in an application rather than a library/tool. (this polyfill is automatically loaded when using babel-node
).
This means you can use new built-ins like Promise
or WeakMap
, static methods like Array.from
or Object.assign
, instance methods like Array.prototype.includes
, and generator functions (provided you use the regenerator plugin). The polyfill adds to the global scope as well as native prototypes like String
in order to do this.