diff --git a/packages/vue-cli-plugin-uni/index.js b/packages/vue-cli-plugin-uni/index.js index 2c854df487eed729d78176804c19c7530ecefc84..9a1bb7f75b78cc2a63141a429939d2386d1b292b 100644 --- a/packages/vue-cli-plugin-uni/index.js +++ b/packages/vue-cli-plugin-uni/index.js @@ -1,5 +1,21 @@ const path = require('path') +const crypto = require('crypto') + +/** + * The MD4 algorithm is not available anymore in Node.js 17+ (because of library SSL 3). + * In that case, silently replace MD4 by the MD5 algorithm. + */ +try { + crypto.createHash('md4') +} catch (e) { + // console.warn('Crypto "MD4" is not supported anymore by this Node.js version'); + const origCreateHash = crypto.createHash + crypto.createHash = (alg, opts) => { + return origCreateHash(alg === 'md4' ? 'md5' : alg, opts) + } +} + const { manifestPlatformOptions } = require('./lib/env')