Skip to content

Hot Module Replacement #8

@albertromkes

Description

@albertromkes

Is it possible to use the Hot Module Replacement plugin? I've played around with it in the dev.webpack.config file (and start it with 'webpack-dev-server --config dev.webpack.config') but I can't get it to work.

I also updated the configureStore method like this:

export default function configureStore(initialState, history, client) {
  const enhancer = compose(
    applyMiddleware(thunk),
    applyMiddleware(routerMiddleware(history)),
    applyMiddleware(createMiddleware(client)),
    devTools
  )(createStore);

  const finalEnhancer = enhancer(reducer, initialState);
  if (module.hot) {
    // Enable Webpack hot module replacement for reducers
    module.hot.accept('./reducer', () => {
      const nextRootReducer = require('./reducer');
      finalEnhancer.replaceReducer(nextRootReducer);
    });
  }
  // return enhancer(reducer, initialState);
  return finalEnhancer;
}

Any clues?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions