【无标题】Error loading C:\Users\烟幻人生\Desktop\测试\源代码\vue.config.js: ERROR Error [ERR_REQUIRE_ESM]: requ

文章讲述了在处理初学者Vue项目时遇到的错误,错误提示要求将vue.config.js文件的module类型改为commonjs以支持CommonJS模块。解决方案是修改package.json中的type属性。
摘要由CSDN通过智能技术生成

Error loading C:\Users\烟幻人生\Desktop\测试\源代码\vue.config.js: ERROR Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\烟幻人生\Desktop\测试\源代码\vue.config.js from C:\Users\烟幻人生\Desktop\测试\源代码\node_modules\@vue\cli-shared-utils\lib\module.js not supported. vue.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename vue.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in C:\Users\烟幻人生\Desktop\测试\ 源代码\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

这是报错,原因是,这是初学者练手项目,我帮忙解决的,

解决方案:"type": "module",换成 "type": "commonjs",

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值