Skip to content

Commit 370a148

Browse files
Update frontend to Node 18 (#861)
Using v18.18.1 because GitHub Actions uses v18.18.0 at the moment, and it is prone to a bug in webpack: nodejs/node#49911 (comment)
1 parent 89996be commit 370a148

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

.github/workflows/deployment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
- uses: actions/checkout@v4
3333
- uses: actions/setup-node@v3
3434
with:
35-
# Using node version from functions because it's more likely to be the freshest
36-
node-version-file: functions/package.json
35+
# Using node version from frontend because it's more sensitive in this regard
36+
# See https://github.com/nodejs/node/issues/49911#issuecomment-1756119733
37+
node-version-file: frontend/package.json
3738
cache: npm
3839
cache-dependency-path: |
3940
functions/package-lock.json

.renovaterc.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,5 @@
1616
"vulnerabilityAlerts": {
1717
"schedule": ["at any time"],
1818
"dependencyDashboardApproval": false
19-
},
20-
"packageRules": [
21-
{
22-
"matchFileNames": ["frontend/**"],
23-
"matchCategories": ["node"],
24-
"enabled": false
25-
}
26-
]
19+
}
2720
}

frontend/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"test:unit": "npm run test"
1313
},
1414
"engines": {
15-
"node": "16"
15+
"node": "18.18.1"
1616
},
1717
"dependencies": {
1818
"@casl/ability": "4.1.6",

frontend/vue.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
const crypto = require('crypto');
2+
3+
/**
4+
* The MD4 algorithm is not available anymore in Node.js 17+ (because of library SSL 3).
5+
* In that case, silently replace MD4 by the MD5 algorithm.
6+
* From https://stackoverflow.com/a/72219174/3082178.
7+
* Just setting webpack's `output.hashFunction` is not enough,
8+
* something else is using MD4 (see https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported/73465262#comment131441027_73465262).
9+
*/
10+
try {
11+
crypto.createHash('md4');
12+
} catch (e) {
13+
console.warn(
14+
'Crypto "MD4" is not supported anymore by this Node.js version. Using MD5 instead.'
15+
);
16+
const origCreateHash = crypto.createHash;
17+
crypto.createHash = (alg, opts) =>
18+
origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
19+
}
20+
121
module.exports = {
222
chainWebpack: (config) => {
323
config.plugins.delete('prefetch');

0 commit comments

Comments
 (0)