'UnhandledSchemeError: Reading from "node:zlib" is not handled by plugins (Unhandled scheme)

Anyone can help resolve this error? I have tried resolving using polyfills and every other solution i could find online and think by myself but i still keep getting the issues



Solution 1:[1]

Option A

I also encountered this issue when using node-fetch: ^3.0.0 but downgrading to node-fetch: ^2.0.0 resolved it for me.


Option B

You need to declare these as externals. https://webpack.js.org/configuration/externals/

Webpack 4

  target: node

Webpack 5

  externalsPresets: { node: true },

I also use webpack-node-externals but this might not apply in your case.

Related issue: https://github.com/webpack/webpack/issues/13290

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1