JavaScript编译器Babel¶
安装¶
yarn add --dev @babel/core @babel/cli
package.json
"scripts": { "watch": "babel src --out-dir lib --source-maps inline --watch", "build": "babel src --out-dir lib --source-maps inline" },
环境预设¶
yarn add --dev @babel/preset-env
.babelrc
{ "presets": [ [ "@babel/preset-env", { "targets": "> 0.25%, not dead" } ] ] }