ZSWYD

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

posted on 2022-09-09 22:51  苏舒  阅读(897)  评论(0)    收藏  举报

导航