- 首先将报错的依赖uninstall,然后下载最新版。
- 然后会遇到上图的错误,原因是:webpack@4.41.2中Vue-loader必须是15以上的版本,而Vue-loader在15.*之后的版本都是 vue-loader的使用都是需要伴生 VueLoaderPlugin的,所以解决方案是
- 在webpack.config.js中加入
const VueLoaderPlugin = require('vue-loader/lib/plugin');
- 在webpack.config.js中的module.exports中添加new VueLoaderPlugin()
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 : {
}
}