react-inline-grid icon indicating copy to clipboard operation
react-inline-grid copied to clipboard

ReferenceError: window is not defined

Open elverskog opened this issue 10 years ago • 5 comments

Hi - I get the error below passed from the server. My app is isomorphic. It looks like this module is only intended to work for react apps that render on the server. Is that correct or am I missing something? I am currently looking to see if I can suspend execution for the entire module if window is missing.

ReferenceError: window is not defined at /home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:25:17 at Array.map (native) at setState (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:21:16) at MatchMedia.updateState (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:62:18) at new MatchMedia (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/matchMedia.js:49:17) at Object.matchMedia as default at new Grid (/home/ubuntu/react/react-sandbox/node_modules/react-inline-grid/lib/components/Grid.js:138:41) at [object Object].ReactCompositeComponentMixin.mountComponent (/home/ubuntu/react/react-sandbox/node_modules/react/lib/ReactCompositeComponent.js:141:16) at [object Object].wrapper as mountComponent at Object.ReactReconciler.mountComponent (/home/ubuntu/react/react-sandbox/node_modules/react/lib/ReactReconciler.js:37:35)

elverskog avatar Sep 11 '15 20:09 elverskog

Hi @elverskog,

Thanks for the report and I apologize for the amazingly late reply... State management and media detection really need to be rework (I'll have free time the first week of November to handle it). Solving missing window in media detection for server side rendering could be done easily, but I'll prefer to find a better workaround (or doc). I have to dig a bit more in this direction.

broucz avatar Oct 25 '15 10:10 broucz

+1

mattwoodco avatar Feb 28 '17 23:02 mattwoodco

Great module, but that window ... @broucz any suggested workarounds ?

thomasmodeneis avatar Mar 26 '17 11:03 thomasmodeneis

https://webpack.js.org/plugins/provide-plugin/

ghost avatar Mar 26 '17 11:03 ghost

Just got bit by this trying to use it with Next.js. Does anyone know if there is a work around to solve this?

frankhale avatar May 12 '17 22:05 frankhale