美文网首页
webpack vue-loader was used with

webpack vue-loader was used with

作者: 豪斯说 | 来源:发表于2018-11-24 15:43 被阅读11次

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

2018年06月03日 11:26:10 cominglately 阅读数:8125 标签: webpack 更多

个人分类: webpack

<article class="baidu_pl" style="box-sizing: inherit; outline: 0px; margin: 0px; padding: 16px 0px 0px; display: block; position: relative; color: rgba(0, 0, 0, 0.75); font-family: Lato, -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

场景

. 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 : {
    ...
}
}

</article>

相关文章

网友评论

      本文标题:webpack vue-loader was used with

      本文链接:https://www.haomeiwen.com/subject/dxkyqqtx.html