Closed akiran closed 9 years ago
Can't say I do, sorry. If you find a solution please report back :)
@akiran - not sure if you've arrived at a solution, but its easy enough to do something like
if (typeof window !== 'undefined') {
const enquire = require('enquire')
} else {
...
}
I created a mixin that wraps enquire.js to create responsive reactjs components. https://github.com/akiran/react-responsive-mixin
When enquire.js is imported on nodejs for server-side rendering, it is failing with error
ReferenceError: window is not defined
I know this library is not supposed to be used in nodejs. But to build isomorphic apps this library should be compatible with nodejs.
Do you have any thoughts on overcoming this problem.
I also opened a question on stackoverflow http://stackoverflow.com/questions/28275775/how-to-handle-window-object-on-nodejs-for-server-side-rendering-of-reactjs-appli