Skip to content

Commit

Permalink
fix(vue2): 兼容 node 17+
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Apr 19, 2024
1 parent 456d35f commit 97fa4a3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/vue-cli-plugin-uni/index.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down

0 comments on commit 97fa4a3

Please sign in to comment.