react-onclickoutside icon indicating copy to clipboard operation
react-onclickoutside copied to clipboard

ReferenceError: performance is not defined

Open arqex opened this issue 1 year ago • 1 comments

First thanks for this marvelous library. I've been using it for years and work great.

Second, the last version 16.13.1 is breaking my node server.

This is what I getting in the server console

ReferenceError: performance is not defined
    at new OnClickOutside(ClickOut) (webpack-internal:///../../node_modules/react-onclickoutside/dist/react-onclickoutside.cjs.js:262:29)

I could use react-onclickoutside to render my application in the server side without any problems, but performance is not defined by default in node environments, it has to be imported.

An alternative for performance.now() would be Date.now(), that is available everywhere, but maybe it doesn't have the precision needed.

Another alternative is make react-onclickoutside transparent when rendered in the server, just return the component it wraps, as in the server is not possible to make clicks.

arqex avatar Sep 09 '24 10:09 arqex

Sounds like you're on a dead version of Node: which version are you using? performance has been in Node since v16, which is already old enough to have reached EOL.

Pomax avatar Sep 13 '24 15:09 Pomax