webpack vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin

2023-05-16

场景

. webpack2.4.*集成vue-loader@15.2.4报错

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 : {
    ...
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

webpack vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin 的相关文章

随机推荐