HOW TO USE Babel
Babel 相关

Babel 相关知识点

1.什么是babel ?

babel is a toolchain that is mainly used to convert ECMAScript 2015+code into a backwards compatible version of JavaScript in current and older browels or environments

// Babel Input: ES2015 arrow function
[1,2,3].map(n=>n+1)

//Babel Output:ES5 equivalent
[1,2,3].map(function(n){
  return n+1
})

2.什么是babel plugin?

Babel’s code transformation are enabled by applying plugins (or presets) to your configuration file

3.什么是preset-env?

@babel/preset-env is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally,browser polyfills) are needed by your target environment(s). This both makes your life easier and JavaScript bundles smaller!

4.什么是polyfill?


最后修改于 2022-07-18