Skip to content Skip to sidebar Skip to footer

Adding React-hot-loader To Ejected Create-react-app

I am using the instructions from this commit to attempt to add react-hot-loader version 3 to create-react-app. (Scroll to bottom to see babel and webpack configs) Edit: Changing 'w

Solution 1:

Spent half a day on it, using the lates CRA - 1.0.14, Oct 2017, it's terribly simple. Drop all changes and do two things:

1) Add to index.js

if (module.hot) {
  module.hot.accept();
}

2) Update configureStore.js a bit:

if (module.hot && process.env.NODE_ENV !== 'production') {
  module.hot.accept('./reducers', () => {
    const nextRootReducer = require('./reducers'); // eslint-disable-line
    store.replaceReducer(nextRootReducer);
  });
}

return store;

Solution 2:

Seems to be working fine for me with the server shipped with create-react-app v0.6.1. like this: require.resolve('react-dev-utils/webpackHotDevClient'),

Post a Comment for "Adding React-hot-loader To Ejected Create-react-app"