Adding react-hot-loader to ejected create-react-app

后端 未结 2 1589
逝去的感伤
逝去的感伤 2021-01-15 03:21

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 w

相关标签:
2条回答
  • 2021-01-15 04:06

    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;

    0 讨论(0)
  • 2021-01-15 04:06

    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'),

    0 讨论(0)
提交回复
热议问题