Make dependency on window optional
M5150 opened this issue · 2 comments
I am using this package in a node environment (I need state management and I am using rxjs extensively so this project works quite neatly) and I am seeing window is not defined errors when running my application. I understand that you want to provide redux devtools compatibility which requires setting properties on the window. Could you perhaps check the presence of the window
global variable and perform the redux devtools setup logic only if it is defined? If you are open to a pull request let me know.
Hi @M5150,
There was recently a similar issue regarding the undefined window object: #121
I found it strange that the ReduxExtension can throw an error even if it is not used in the configureStore
setup.
You could get an exception here:
if you would somewhere usenew ReduxDevtoolsExtension({})
.
Can you check if that is the case?
Or do you get the error here already?
Do you have a stacktrace or the exact error message?
I would be glad to see a PR when we clarified the issue a little bit more :)
Super cool that you are using MiniRx in Node! I never intended that and tested it, but great if it works!
The issue is the line const win = window as any;
. The issue is resolved by using globalThis
instead of window
.