Webpack 4.X incompatible with node.js 17.
Opened this issue · 0 comments
tflucke commented
The issue:
This project depends on webpack 4.X. If your system uses node.js 17, it depends on openSSL 3.0 which has more restrictive encryption options that are not compatible with webpack 4.X.
Steps to reproduce
- Install node.js 17 and openSSL 3.0
- Attempt to build a project using scalajs-webpack-loader
Example error:
[info] Fast optimizing /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/web-fastopt
[info] Writing scalajs.webpack.config.js
[info] Bundling the application with its NPM dependencies
[error] /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:114
[error] throw e;
[error] ^
[error] Error: error:0308010C:digital envelope routines::unsupported
[error] at new Hash (node:internal/crypto/hash:71:19)
[error] at Object.createHash (node:crypto:130:10)
[error] at module.exports (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/util/createHash.js:90:53)
[error] at NormalModule._initBuildHash (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:402:16)
[error] at handleParseError (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:450:10)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:482:5
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/lib/NormalModule.js:343:12
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:373:3
[error] at iterateNormalLoaders (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
[error] at iterateNormalLoaders (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:236:3
[error] at context.callback (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
[error] at processMap (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/source-map-loader/index.js:103:3)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/source-map-loader/index.js:99:5
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/async/dist/async.js:1143:9
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/async/dist/async.js:473:16
[error] at iteratorCallback (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/async/dist/async.js:1067:13)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/async/dist/async.js:972:16
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/async/dist/async.js:1140:13
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/source-map-loader/index.js:75:14
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/Resolver.js:213:14
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/Resolver.js:285:5
[error] at eval (eval at create (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/Resolver.js:285:5
[error] at eval (eval at create (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/Resolver.js:285:5
[error] at eval (eval at create (/space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
[error] at /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/enhanced-resolve/lib/Resolver.js:285:5 {
[error] opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
[error] library: 'digital envelope routines',
[error] reason: 'unsupported',
[error] code: 'ERR_OSSL_EVP_UNSUPPORTED'
[error] }
[error] Failure on parsing the output of webpack: No content to map due to end-of-input
[error] at [Source: (ProcessPipeInputStream); line: 1, column: 0]
[error] You can try to manually execute the command
[error] node /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/node_modules/webpack/bin/webpack --bail --profile --json --config /space/tom/workspace/budget-UNAMED/web/target/scala-2.13/scalajs-bundler/main/scalajs.webpack.config.js
The webpack versions 5.X+ resolve this issue.
Temporary Workaround:
Prefix NODE_OPTIONS=--openssl-legacy-provider
to your sbt commands.