webpack 默认不能处理vue文件,需要安装对应的load才可以

1.安装vue-loader和vue-template-compiler

npm install vue-loader vue-template-compiler --save-dev

2.修改webpack.config.js

  module: {
      rules: [
        ......
        {
          test: /\.vue$/,
          use: {
            loader: 'vue-loader',
          }
        }
      ]
    }

 

再次打包依然报错

ERROR in 
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.

可能是因为vue-router 版本是15以上引起的

需要在webpack.config.js中添加如下配置

const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports  = {
    plugins: [   //插件配置
        new VueLoaderPlugin()
    ],
    module: {
      ......  
    }
};    

 

相关文章:

  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2021-04-07
  • 2021-08-19
  • 2021-08-08
  • 2022-12-23
相关资源
相似解决方案