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