踩坑记录: * ./node_modules/[email protected]@vue-loader/lib/index.js You may need an additional load...

error:

ERROR in ./src/login.vue?vue&type=template&id=19e76240& 2:0
Module parse failed: Unexpected token (2:0)
File was processed with these loaders:
 * ./node_modules/[email protected]@vue-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|
> 
|
@ ./src/login.vue 1:0-84 10:2-8 11:2-17 30:4-35:6 30:68-35:5 32:16-22 33:25-40 @ ./src/main.js

在webpack搭建的环境当中运行vue组件的时候报错,我已经下载了vue-template-compilervue-loader,在render中还是无法正常显示组件内容,查了下资料发现是

Vue-loader在15.*之后的版本都是 vue-loader的使用都是需要伴生 VueLoaderPlugin的

所以我们要在这两个的基础上再去下载这个插件
npm i vue-loader-plugin -S
然后在配置文件(webpack.config.js)那边要加上

// webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
  // ...
  plugins: [
    new VueLoaderPlugin()
  ]
}

资料来源:https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required

你可能感兴趣的:(踩坑记录: * ./node_modules/[email protected]@vue-loader/lib/index.js You may need an additional load...)