运行报错 vue-loader was used without corrresponding plugin 原因

引入.vue文件,安装完vue-loader和vue-template-compiler后,在webpack.config.js中配置

{ test:/\.vue$/, use: 'vue-loader' }

但是,运行报错:

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

这是因为vue-loader,15.*版本之后的版本的使用都需要添加plugin的配置。有两种解决方法:

1.安装14版本的vue-loader

2.在webpack.config.js中添加:

const { VueLoaderPlugin } = require('vue-loader')


 
module.exports = {

  plugins: [
    new VueLoaderPlugin()
  ]

}

猜你喜欢

转载自blog.csdn.net/sleepwalker_1992/article/details/82082209