问答详情
源自:2-1 vue-loader+webpack项目配置

救救孩子吧

https://img3.mukewang.com/5ce507190001265513870719.jpg

ERROR in ./src/app.vue

Module Error (from ./node_modules/vue-loader/lib/index.js):

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

 @ ./src/index.js 2:0-27 7:18-21


ERROR in ./src/app.vue?vue&type=template&id=5ef48958& 2:0

Module parse failed: Unexpected token (2:0)

You may need an appropriate loader to handle this file type.

> <div>nppm</div>

 @ ./src/app.vue 1:0-82 10:2-8 11:2-17

 @ ./src/index.js

npm ERR! code ELIFECYCLE

npm ERR! errno 2

npm ERR! vue-ssr-tech@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the vue-ssr-tech@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


提问者:天河区热心网友 2019-05-22 16:22

个回答

  • 慕沐8789467
    2019-07-26 15:20:16

    你的插件和loader没有装好,需要看下你的代码。你删掉node_modules再重装一遍吧,我用的yarn就好了。

    npm国内下载包很容易出问题,建议使用cnpm 或者 yarn。

    我已经学完了课程,并完成了项目代码并做了笔记,你可以参考一下我的代码https://github.com/carrieguo/vue.js-learn


  • qq_慕依萱萱_0
    2019-05-27 11:51:20

    为啥加上还不行啊


  • 天河区热心网友
    2019-05-22 16:31:27

    行了 有同样问题的可以试试
    const path = require('path')

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

    module.exports = {

    entry:path.join(__dirname,'src/index.js'),

    output:{

    filename:'bundle.js',

    path:path.join(__dirname,'dist')

    },

    module:{

    rules:[

    {

    test:/.vue$/,

    loader:'vue-loader'

    }

    ]

    },

    plugins:[

    new VueLoaderPlugin()

    ]

    }