更新时间:2023-09-27 23:23:52
从babel 6发行说明:
From the babel 6 Release notes:
由于Babel专注于成为JavaScript工具的平台,而不是ES2015转换器,我们决定制作所有插件都选择加入。这意味着当您安装Babel时,它将不再默认转换您的ES2015代码。
Since Babel is focusing on being a platform for JavaScript tooling and not an ES2015 transpiler, we’ve decided to make all of the plugins opt-in. This means when you install Babel it will no longer transpile your ES2015 code by default.
在我的设置中我安装了es2015预设
In my setup I installed the es2015 preset
npm install --save-dev babel-preset-es2015
或使用纱线
yarn add babel-preset-es2015 --dev
并启用我的.babelrc中的预设
and enabled the preset in my .babelrc
{
"presets": ["es2015"]
}