whetstone / redux-devtools-diff-monitor

https://www.npmjs.com/redux-devtools-diff-monitor
176 stars 14 forks source link

Cannot require in node #10

Closed s-panferov closed 8 years ago

s-panferov commented 9 years ago

Cannot require redux-devtools-diff-monitor in node with webpack:

/Users/panferov-s/Workspace/alfa-listing/node_modules/redux-devtools-diff-monitor/node_modules/mousetrap/mousetrap.js:1021
}) (window, document);
    ^
ReferenceError: window is not defined
    at Object.<anonymous> (/Users/panferov-s/Workspace/alfa-listing/node_modules/redux-devtools-diff-monitor/node_modules/mousetrap/mousetrap.js:1021:5)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/panferov-s/Workspace/alfa-listing/node_modules/redux-devtools-diff-monitor/lib/index.js:33:18)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
ruprict commented 9 years ago

:+1:

iktl commented 9 years ago

Thanks for this report, I'm hoping to block time tonight to resolve. Will keep you posted.

igl commented 9 years ago

Tried to if-else my way around this problem without success. Has anyone tested this with react-0.14.0-rc1 yet?

if (__CLIENT__) {
    monitor = require('redux-devtools-diff-monitor')
} else {
    monitor = LogMonitor
}

Warning: ManifestComponent(...): React component classes must extend React.Component Uncaught Error: Invariant Violation: ManifestComponent.render(): A valid ReactComponent must be returned.

iktl commented 8 years ago

This should be fixed now since we are deferring to devtools itself for hotkeys and the like (mousetrap is no longer used). Let me know if this persists.