@babel/runtime-corejs2
@babel/runtime-corejs2
open in new window类似于@babel/runtime
,但是增加了polyfill
的功能。
因此,该插件可以代替polyfill
,将 Promise 或 Symbol 转换为引用core-js
库里的函数 ,但不能对内置对象的实例方法进行转换。
Promise;
1
转换为:
var _Promise = require("@babel/runtime-corejs2/core-js/promise.js");
1
Babel 的辅助工具函数helpers
也是这么转换的。