I working on React project. I'm trying to use the npm package async-polling (https://www.npmjs.com/package/async-polling), that wants to use the inherits class of the node-utils ; Internally the library has the following lines:
var inherits = hasWindow ? window.nodeUtil.inherits : require('util').inherits;
var EventEmitter = hasWindow ? window.nodeEventEmitter : require('events').EventEmitter;
Of course since the app is running in the browser, hasWindow is true. But there is no nodeUtil or nodeEventEmitter. Therefore I get the error:
TypeError: Cannot read property 'inherits' of undefined
Then I tried adding the util and events package and doing this:
window.nodeUtil = require('util');
window.nodeEventEmitter = require('events');
But I got this error:
TypeError: AsyncPolling is not a constructor
Anther fork was able to fix this issue, but I want to try and stick with the original package, is there a way to fix the issue?