- 首先將報錯的依賴uninstall,然後下載最新版。
- 然後會遇到上圖的錯誤,原因是:[email protected]中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 : {
}
}