couzic / lenrix

Type-safe, reactive, focusable redux store wrapper
MIT License
24 stars 1 forks source link

webpack hot module reload support #48

Open c-jacquin opened 6 years ago

c-jacquin commented 6 years ago

In order to make webpack hot module reload work properly we need to have something like this to update the store when an update, a computed value or an epic is modified.

redux and redux-observable already implement this feature.

Do you think it is possible ? easy ?

if (module.hot) {
  module.hot.accept('../reducers', () =>
    store.replaceReducer(require('../reducers')) // eslint-disable-line global-require
  );

  const epic$ = new BehaviorSubject(rootEpic);
  module.hot.accept('./where-ever-they-are', () => {
    const nextRootEpic = require('./where-ever-they-are').rootEpic;
    epic$.next(nextRootEpic);
  });
}

https://redux-observable.js.org/docs/recipes/HotModuleReplacement.html

couzic commented 6 years ago

It seems like it can be done. I have to find a couple hours to write the code. Is it urgent ?