// The cheapest way I found to “solve” this issue in vite is to mock node.js modules in vite.config.ts:
define: {
global: {},
stream: {},
process: {},
},
// and to fake “inherits” module and do the check there
{
resolve: {
alias: {
inherits: './inherits.js',
},
},
}
//in inherits.js you can put an easy check.
function inherits(ctor, superCtor) {
if (!superCtor.prototype) return;
// eslint-disable-next-line no-underscore-dangle
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true,
},
});
}
module.exports = inherits;