I'm working on adding server-side rendering to my redux app. As part of that I need to import my routes which contains import references to my components which themselves import reapp-ui. Simply importing these things fails in Node with errors like the following:
if (!('ontouchstart' in window)) emulateTouch({
^
ReferenceError: window is not defined
at Object.<anonymous> (/Users/<...>/node_modules/reapp-ui/lib/desktopTouch.js:4:25)
AFAICT this means that reapp-ui is not suitable for server-side rendering. Am I missing something? Is there a way to somehow inject a mock window object?
Alternatively, is there a way to move this behavior into a function so it's not executed merely on import?
I'm working on adding server-side rendering to my redux app. As part of that I need to import my routes which contains import references to my components which themselves import
reapp-ui
. Simply importing these things fails in Node with errors like the following:AFAICT this means that reapp-ui is not suitable for server-side rendering. Am I missing something? Is there a way to somehow inject a mock window object?
Alternatively, is there a way to move this behavior into a function so it's not executed merely on import?