webpack打包less:Module build failed: TypeError: loaderContext.getResolve is not a function问题

本文解决因Less-Loader版本过高导致的打包错误,通过卸载并安装指定低版本(4.1.0),成功实现项目打包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误如下:

在这里插入图片描述
我在这里出现的错误原因是安装的 less-loader 版本太高,使用 npm i --save-dev less-loader自动安装了 6.2.0 版本。

在这把原来安装的删除 npm uninstall less-loader,然后安装较低的版本 npm i --save-dev less-loader@4.1.0 ,这里的 --save-dev 是开发时使用的,如果仅学习可加可不加。

换成低版本之后就能打包成功了
在这里插入图片描述

{ "name": "my-project1", "version": "0.1.0", "private": true, "scripts": { "start": "voyo-run --config global/command/main-command.js", "exportB64Json": "node tool/base64-icons/convert.js" }, "sideEffects": [ "*.vue", "*.wxss", "*.css", "*.scss", "*.websass", "**/*.module.ts", "src/init.js" ], "dependencies": { "@dcloudio/uni-app-plus": "^2.0.0-28920200907001", "@dcloudio/uni-cli-i18n": "^2.0.2-4060620250520001", "@dcloudio/uni-h5": "^2.0.0-28920200907001", "@dcloudio/uni-helper-json": "*", "@dcloudio/uni-i18n": "^2.0.1-34920220630001", "@dcloudio/uni-mp-360": "^2.0.0-28920200907001", "@dcloudio/uni-mp-alipay": "^2.0.0-28920200907001", "@dcloudio/uni-mp-baidu": "^2.0.0-28920200907001", "@dcloudio/uni-mp-qq": "^2.0.0-28920200907001", "@dcloudio/uni-mp-toutiao": "^2.0.0-28920200907001", "@dcloudio/uni-mp-vue": "^2.0.0-28920200907001", "@dcloudio/uni-mp-weixin": "^2.0.0-28920200907001", "@dcloudio/uni-quickapp-native": "^2.0.0-28920200907001", "@dcloudio/uni-quickapp-webview": "^2.0.0-28920200907001", "@dcloudio/uni-stat": "^2.0.0-28920200907001", "@dcloudio/uni-ui": "^1.4.19", "@types/crypto-js": "^4.0.1", "@voyo/core": "^1.0.0", "@voyo/core-style": "^2.5.4", "@voyo/http": "^3.5.2", "@voyo/ui-uni": "2.5.5", "@vue/shared": "^3.0.0-rc.4", "@ztwx/form": "^2.1.0", "@ztwx/webfont": "^0.0.1", "aes-js": "^3.1.2", "core-js": "^3.6.5", "crypto-js": "^4.1.1", "flyio": "^0.6.2", "js-base64": "^2.6.3", "regenerator-runtime": "^0.12.1", "vue": "^2.6.11", "vue-class-component": "^6.3.2", "vue-property-decorator": "^8.5.1", 下午1:45:50 error in ./src/info.ts Syntax Error: TypeError: loaderContext.getOptions is not a function @ ./src/main.js 8:0-30 122:0-4 123:0-4 Build failed with errors.
最新发布
06-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值