vueloader报错


为了引入.vue文件,安装完vue-loader和vue-template-compiler后,运行报错:

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

是因为vue-loader,15的版本需要再添加plugin的配置。有两种解决方法:

1.把安装版本改为14的

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

const { VueLoaderPlugin } = require('vue-loader')
 
module.exports = {
  // ...
  plugins: [
    new VueLoaderPlugin()
  ]
}

  如果直接去掉VueLoaderPlugin两边的{},会报错,如下:TypeError: loaderContext.emitError is not a function at new module.exports ,想去掉这个{},需要把require里面的内容改一下

const VueLoaderPlugin = require('vue-loader/lib/plugin');

  这样就可以。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM