From 97fa4a3adc1a125b2a0566869f488345ec396dc4 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 19 Apr 2024 11:14:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(vue2):=20=E5=85=BC=E5=AE=B9=20node=2017+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vue-cli-plugin-uni/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/vue-cli-plugin-uni/index.js b/packages/vue-cli-plugin-uni/index.js index 2c854df48..9a1bb7f75 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') -- GitLab