We are facing the issue
"Reference Error: self is not defined'
while trying to use React-data-grid. The issue is on the server side while trying to build the nodejs application using webpack. We are facing issue in the generated bundle file in the following lines
isOldIE = memoize(function() { return /msie
[6-9]\b/.test(self.navigator.userAgent.toLowerCase()); }),
Could you let us know how can we fix this. It looks like the react data grid package has issues with the server side rendering.
To solve the "ReferenceError require is not defined" error, remove the type property if it's set to module in your package. json file and rename any files that have a . mjs extension to have a . js extension.
The Javascript ReferenceError occurs when referencing a variable that does not exist or has not yet been initialized in the current scope. The ReferenceError: event is not defined usually occurs while using an event handler if the event parameter is either not declared or declared incorrectly.
The #REF! error shows when a formula refers to a cell that's not valid. This happens most often when cells that were referenced by formulas get deleted, or pasted over.
The ReferenceError object represents an error when a variable that doesn't exist (or hasn't yet been initialized) in the current scope is referenced.
self
is likely referring to window
which is not available on the server side...it's only available in a browser context. The navigator
reference makes this especially apparent. This code is trying to test the user agent for Internet Explorer verison.
self.navigator.userAgent.toLowerCase()
As Jordan pointed out, there is an open issue #361 regarding isomorphic rendering.
If possible, try to avoid executing that code when on the server-side. Otherwise, you'll have to wait for a patch in react-data-grid
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With