在使用webpack打包时遇到的问题(ERROR in Entry module not found: Error: Can’t resolve ‘babel-loader’ in……)解决方案:
- 首先执行如下命令安装babel-loader加载器
cnpm install babel-loader --save-dev
- 执行 npm run dev 命令运行webpack会报出错误
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’.
不要着急此时需要安装一下babel-core,执行如下命令:
cnpm install --save-dev babel-loader@7
- 再次执行 npm run dev 命令运行webpack就不会再报错了