[vue] Have you used the babel-polyfill module? What is it mainly used for?

[vue] Have you used the babel-polyfill module? What is it mainly used for?

Babel默认只转换新的JavaScript句法(syntax),而不转换新的API,比如Iterator、Generator、Set、Maps、Proxy、Reflect、Symbol、Promise等全局对象,以及一些定义在全局对象上的方法(比如Object.assign)都不会转码。

举例来说,ES6在Array对象上新增了Array.from方法。Babel就不会转码这个方法。如果想让这个方法运行,必须使用babel-polyfill,为当前环境提供一个垫片。

Babel默认不转码的API非常多,详细清单可以查看babel-plugin-transform-runtime模块的definitions.js文件。

Personal profile

I am a song, welcome to share front-end and back-end knowledge with you. It is easy to give up,
but it must be cool to persist. Welcome everyone to discuss

Main directory

Clear the front-end interview questions with song

Guess you like

Origin blog.csdn.net/weixin_43392489/article/details/114096418