Cannot find package 'babel-preset-stage-2' imported from
问题记录
解决方法
改babel.config.js配置
根据:
https://zhuanlan.zhihu.com/p/337075666
npm i @babel/plugin-transform-runtime -D
npm i @babel/runtime-corejs3
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3
}
]
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 3 // 指定 runtime-corejs 的版本,目前有 2 3 两个版本
}
]
]
}
然后报Invalid Option: corejs is not a valid top-level option.
Maybe you meant to use 'targets'?
解决方法: 删除node_modules,重新npm i
没有什么是一蹴而就的。
浙公网安备 33010602011771号