使用 Babel
如何将 Babel 与你选择的工具结合使用。
1选择你的工具(推荐 CLI)
Prototyping
Babel built-ins
Build systems
Frameworks
Test frameworks
Utilities
Language APIs
Template engines
Editors and IDEs
Debuggers
2安装
3用法
4创建 babel.config.json 配置文件
Great! You've configured Babel but you haven't made it actually do anything. Create a babel.config.json config in your project root and enable some presets.
To start, you can use the env preset, which enables transforms for ES2015+
npm install @babel/preset-env --save-dev
In order to enable the preset you have to define it in your babel.config.json file, like this:
{
"presets": ["@babel/preset-env"]
}