Search code examples
reactjsnpmwebpackreduxredux-devtools

Why is the ActionCreators property undefined in my _reduxDevtools object using redux devtools?


Following the document on the official repo, when I create a DevTools component, a configureStore store and render the DevTools component in my main component in my working react app, I end up with an:
Uncaught TypeError: Cannot read property 'reset' of undefined in LogMonitor.js:45.

Line 45 corresponds to:var reset = _reduxDevtools.ActionCreators.reset;

_reduxDevtools looks like this:

▼ _reduxDevtools: Object
    __esModule: true
    ► devTools: devTools()
    ► persistState: persistState(sessionId)
    ► __proto__: Object

The ActionCreators property is, in fact, missing.

Why is the ActionCreators property undefined in my _reduxDevtools object?

Am I missing something obvious? My application is working well when I don't use redux-devtools so I highly doubt it's coming from my app's code.

I also rm -rfed my node_modules and reinstalled everything.


Update

I tried to reproduce the issue using the counter example of redux-devtools and tried to see how my project and this example differ.

If I remove this line from webpack.config.js on the counter example, I have the same error message:

'redux-devtools': path.join(__dirname, '..', '..', 'src')

resolve.alias: Replace modules by other modules or paths.


Solution

  • It seems that you're using an outdated version of redux-devtools while using the new API first introduced in the v3.0.0-beta-2.

    You can also see this by looking at the peer dependencies of the dock and log monitor plugins, that they require devTools v3.

    I'm guessing you got this error since when you installed, the stable release wasn't out yet and npm didn't pick the beta version, leaving you with the v2.

    I bumped the redux-devtools version from your reprod to the last one and everything worked perfectly


    Also, the resolve param of the webpack configuration in the examples is only there to require devTool source from the root of the repository without having to install it again.