Webpack Digital Envelop Build Error - egnomerator/misc GitHub Wiki

Interesting Webpack Build Error - Digital Envelop

I saw an interesting error during a Webpack build while running on Node.js v17.0.1 - i THINK this might have started on v17+ (didn't see it on earlier versions)

special note on NVM:

  • NVM was especially handy while i was looking at this error
  • it made it very quick and easy to switch between versions of Node.js to observe the different behave between versions

The error:

  • "Error : error : 0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19)"

a helpful source

the fix i used

  • use the following in package.json scripts -- SET NODE_OPTIONS=--openssl-legacy-provider
  • example:
    • "dev": "npm run typescheck && SET NODE_OPTIONS=--openssl-legacy-provider && webpack --mode=development",
  • is this "fix" a security issue?? i don't think so, because webpack is just using the hash algorithm during optimization--not fur security

note on the fix

  • i really don't know if this is the right way to handle this error
  • it wasn't clear to me from the above source if there is a problem with this approach
  • best i could tell, it seemed to me that Webpack is using an old hashing algorithm
  • maybe the webpack config change would be a better fix, i didn't bother to try that yet
⚠️ **GitHub.com Fallback** ⚠️