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.
你的插件和loader没有装好,需要看下你的代码。你删掉node_modules再重装一遍吧,我用的yarn就好了。
npm国内下载包很容易出问题,建议使用cnpm 或者 yarn。
我已经学完了课程,并完成了项目代码并做了笔记,你可以参考一下我的代码https://github.com/carrieguo/vue.js-learn
为啥加上还不行啊
行了 有同样问题的可以试试
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()
]
}