Using Buffer and zlib from this rollup-plugin-polyfill-node package
In zlib.js polyfill, when an error occurs, zlib is supposed to emit and error. Related code below:
this._binding.onerror = function(message, errno) {
// there is no way to cleanly recover.
// continuing only obscures problems.
self._binding = null;
self._hadError = true;
var error = new Error(message);
error.errno = errno;
error.code = binding.codes[errno];
self.emit('error', error);
};
But it seems that binding.codes is undefined, and an uncaught TypeError is thrown instead:
zlib.inflateRawSync(Buffer.from(""))
index.js:5 Uncaught TypeError: Cannot read properties of undefined (reading '-5')
at Zlib._binding.onerror (index.js:5:35)
at Zlib$1._error (index.js:5:35)
at Zlib$1._write (index.js:5:35)
at Zlib$1.writeSync (index.js:5:35)
at Zlib._processChunk (index.js:5:35)
at zlibBufferSync (index.js:5:35)
at Object.inflateRawSync (index.js:5:35)
at <anonymous>:1:6
Using Buffer and zlib from this rollup-plugin-polyfill-node package
In zlib.js polyfill, when an error occurs, zlib is supposed to emit and error. Related code below:
But it seems that
binding.codes
is undefined, and an uncaught TypeError is thrown instead: