问题1 :Error: Cannot find module ‘@babel/core’
babel-loader@8 requires Babel 7.x (the package ‘@babel/core’). If you’d like to use Babel 6.x (‘babel-core’), you should install ‘babel-loader@7’.
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:981:15)
解决方案:
- 先卸载掉 babel-core
npm un babel-core
- 然后下载 @babel/core
cnpm i -D @babel/core
问题2:Plugin/Preset files are not allowed to export objects, only functions. In 。。。
这还是版本的问题:查看了一下
解决方式:
- 先卸载了 babel-loader 的高版本
npm un babel-loader
- 然后安装 7.X版本的 babel-loader
npm i babel-loader@7 -D
最后成功的package.json文件的babel版本!