处理错误:vue-loader was used without the corresponding plugin. Make sure to include VueLoad……

在webpack中使用vue运行webpack时报错:

处理错误:vue-loader was used without the corresponding plugin. Make sure to include VueLoad……_第1张图片

解决方案:

第一步:在webpack.config.js配置文件中导入插件VueLoaderPlugin插件:

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

第二步:在导出模块(module.exports)中的plugins属性中new一个实例:

module.exports={
	entry:'./src/main.js',
    output:{
        path:path.join(__dirname,'dist'),
        filename:'bundle.js'
    },
    plugins:[
        new htmlWebpackPlugin({
            template:'./src/index.html',
            filename:'index.html'
        }),
     	new VueLoaderPlugin()
    ]
}

你可能感兴趣的:(前端)