背景webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发 解决过程
  • cnpm(npm) install babel-loader --save 安装此插件
    webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发_02
  • 再次运行webpack命令,这时会提示 ​​Error: Cannot find module ‘@babel/core’…you should install ‘babel-loader@7​webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发_03

根据提示,采用

cnpm install --save-dev babel-loader@7

安装“babel-loader@7”

webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发_04

  • 再次运行webpack命令,这时会提示
    webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发_05
    所以执行
cnpm install --save-dev babel-core

webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发_06

  • 执行打包命令,继续报错
    webpack打包报错:Module not found: Error: Cannot resolve module ‘babel-loader‘_Web开发_07