uniapp 项目, npm update 以后打包出现问题。
编译器版本: 3.1.13
Hbuilderx版本:3.1.13
问题描述:
[HBuilder] 17:34:57.328 编译器版本:3.1.13(v3)详见:https://ask.dcloud.net.cn/article/36599。 [HBuilder] 17:34:57.481 正在编译中... [HBuilder] 17:34:59.437 ERROR TypeError: config.optimization.minimizer(...).tap is not a function [HBuilder] 17:34:59.443 TypeError: config.optimization.minimizer(...).tap is not a function [HBuilder] 17:34:59.444 at chainWebpack (/Users/tomxiao/code/uniapp/IotApp/node_modules/@dcloudio/uni-app-plus/lib/uni.config.js:60:47) [HBuilder] 17:34:59.450 at /Users/tomxiao/code/uniapp/IotApp/node_modules/@dcloudio/vue-cli-plugin-uni/index.js:81:14 [HBuilder] 17:34:59.450 at webpackChainFns.forEach.fn (/Users/tomxiao/code/uniapp/IotApp/node_modules/@vue/cli-service/lib/Service.js:242:40) [HBuilder] 17:34:59.456 at Array.forEach (<anonymous>) [HBuilder] 17:34:59.457 at Service.resolveChainableWebpackConfig (/Users/tomxiao/code/uniapp/IotApp/node_modules/@vue/cli-service/lib/Service.js:242:26) [HBuilder] 17:34:59.466 at PluginAPI.resolveChainableWebpackConfig (/Users/tomxiao/code/uniapp/IotApp/node_modules/@vue/cli-service/lib/PluginAPI.js:151:25) [HBuilder] 17:34:59.466 at module.exports (/Users/tomxiao/code/uniapp/IotApp/node_modules/@vue/cli-service/lib/commands/build/resolveAppConfig.js:2:22) [HBuilder] 17:34:59.477 at getWebpackConfig (/Users/tomxiao/code/uniapp/IotApp/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:71:88) [HBuilder] 17:34:59.495 at getWebpackConfigs (/Users/tomxiao/code/uniapp/IotApp/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:107:32) [HBuilder] 17:34:59.495 at build (/Users/tomxiao/code/uniapp/IotApp/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:137:26) [HBuilder] 17:34:59.511 at api.registerCommand (/Users/tomxiao/code/uniapp/IotApp/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:62:11) [HBuilder] 17:34:59.511 at Service.run (/Users/tomxiao/code/uniapp/IotApp/node_modules/@vue/cli-service/lib/Service.js:236:12) [HBuilder] 17:34:59.528 at Object.<anonymous> (/Users/tomxiao/code/uniapp/IotApp/node_modules/@vue/cli-service/bin/vue-cli-service.js:37:9) [HBuilder] 17:34:59.528 at Module._compile (module.js:652:30) [HBuilder] 17:34:59.544 at Object.Module._extensions..js (module.js:663:10) [HBuilder] 17:34:59.545 at Module.load (module.js:565:32)
原因: 升级因为的冲突, 可以回退到 之前的版本。
解决方法:屏蔽该文件一段代码, 不影响打包;
文件路径: node_modules/@dcloudio/uni-app-plus/lib/uni.config.js
文件内容:
处理后即可正常打包: