Module parse failed Unexpected token (327) File was processed with these loaders .node_module

这篇博客针对Vue.js的模块解析错误提供了解决方案,特别提到了在vue2和vue3版本中不同的处理方式。对于vue2,错误可能由于版本不匹配或缺少vue-loader导致,需要确保版本一致并安装最新vue-loader。而在vue3,由于其自带loader,不推荐添加vue-loader,若遇到'lang=‘ts’'问题,需引入typescript和ts-loader,并配置webpack。
摘要由CSDN通过智能技术生成
Module parse failed: Unexpected token (10:27)
File was processed with these loaders:
 * ./node_modules/vue-loader-v16/dist/templateLoader.js
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/vue-loader-v16/dist/index.js
You may need an additional loader to handle the result of these loaders.

vue2.*

该错误解决办法如下

vue.config.js
{
	// ***********
	configureWebpack: {
	    module: {
	      rules: [
	        {
	          test: /.vue$/,
	          use: [
	            {
	              loader: 'vue-loader',
	            },
	          ],
	        }
	      ],
	    },
	  }
	  // **************
  }

接下来可能报这个错误

Syntax Error: TypeError: Cannot read property ‘parseComponent‘ of undefined

看下vue版本和@vue/compiler-sfc版本,记得保持一致,还有一个vue-loader下载最新的

npm i @vue/compiler-sfc@latest
npm i vue-loader@next

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值