Split up a compose for HMR
In
export default compose(
withRouter,
withTranslation(),
graphql(...),
)(MyClass);
Out
const _decomposed = MyClass;
const _decomposed2 = graphql(...);
const _decomposed3 = _decomposed2(_decomposed);
const _decomposed4 = withTranslation();
const _decomposed5 = _decomposed4(_decomposed3);
const _decomposed6 = withRouter;
const _decomposed7 = _decomposed6(_decomposed5);
export default _decomposed7;
$ npm install babel-plugin-decompose
.babelrc
{
"plugins": ["decompose"]
}
$ babel --plugins decompose script.js
require("babel-core").transform("code", {
plugins: ["decompose"]
});