gregrs-uk / fhodot

Food hygiene open data OpenStreetMap tool
https://gregrs.dev.openstreetmap.org/fhodot/
GNU General Public License v3.0
9 stars 3 forks source link

Update to Node 18 #20

Closed KasperFranz closed 9 months ago

KasperFranz commented 11 months ago

This pull request updates the docker instance to use node 18 instead of node 12 (Node 12 has been EOL for over one year)

I have, in this PR, also changed so the minimum version of Node is 18.8.

While installing everything fresh with Node 18, I ran into an issue with the version of leaflet.markercluster, which I have now updated to the latest one.

KasperFranz commented 11 months ago

I have executed a npm audit fix to fix some of the issues that was highlighted

gregrs-uk commented 11 months ago

I'd like to use Node v18.17.1 because that's what's running on the OSM development server where FHODOT is hosted. I've tried updating to this but when running docker-compose run node npm run build to build the frontend, I'm getting the following error. Did you come across this?

ERROR in index.15f3a6e3223e864b6362.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at /fhodot/node_modules/terser-webpack-plugin/dist/index.js:217:37
    at Array.forEach (<anonymous>)
    at TerserPlugin.optimizeFn (/fhodot/node_modules/terser-webpack-plugin/dist/index.js:160:259)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/fhodot/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/fhodot/node_modules/tapable/lib/Hook.js:154:20)
    at /fhodot/node_modules/webpack/lib/Compilation.js:1409:36
    at eval (eval at create (/fhodot/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /fhodot/node_modules/html-webpack-plugin/lib/cached-child-compiler.js:267:53
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
KasperFranz commented 11 months ago

I vaguely remember that error - let me see what I can do with it.

It is fixed in webpack 5 - but not getting resolved in webpack 4 https://github.com/webpack/webpack/issues/14532

Do you want me to add the workaround?

Edit: I added the workaround

gregrs-uk commented 9 months ago

Many thanks for this @KasperFranz. Closing in favour of f580812, where I have tidied up the commit history and marked you as co-author. Unfortunately npm audit fix broke tests.html.