親測有效。原文鏈接
https://blog.csdn.net/cominglately/article/details/80555210
場景
. webpack2.4.*集成[email protected]報錯
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
分析
. 參考官方文檔 https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required
. Vue-loader在15.*之後的版本都是 vue-loader的使用都是需要伴生 VueLoaderPlugin的,
解決
. 在webpack.config.js中加入
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
devtool: "sourcemap",
entry: './js/entry.js', // 入口文件
output: {
filename: 'bundle.js' // 打包出來的wenjian
},
plugins: [
// make sure to include the plugin for the magic
new VueLoaderPlugin()
],
module : {
...
}
}