先上我的报错信息,看看是否一样?
You may need an additional loader to handle the result of these loaders
This is probably not a problem with npm. There is likely additional logging output above
大概意思就是需要装loader来解决可选链的报错信息。在网上找了好久,发现这类文章比较少,特此记录。
1、babel.config.js添加如下内容
2、安装编译可选链的包
npm i babel-plugin-lodash
npm i lodash-webpack-plugin
npm install @babel/plugin-proposal-nullish-coalescing-operator --save
完成,再执行 npm run test即可完成打包
参考文章:https://www.csdn.net/tags/NtDakg5sNDA4MDItYmxvZwO0O0OO0O0O.html