Webpack打包警告: We noticed you're u
2021-02-20 本文已影响0人
冷r

WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js@2 npm install --save core-js@3
yarn add core-js@2 yarn add core-js@3
大致错误意思:
您还应该确保传递给“corejs”选项的版本与“包”中指定的版本匹配。json的“依赖性”部分。如果没有,则需要运行以下命令之一,但是运行之后还是运行不起来 查阅的资料解决了
解决方法
// .babelrc
{
presets: [
[
'@babel/preset-env',
{
targets: '> 1%,last 2 versions,not ie <= 8',
useBuiltIns: 'entry',
corejs: '3'//加上他就解决了
}
]
],
}