Here's an example: https://github.com/mqklin/hot-loader-lazy-modules-bug
import NotLazy from './NotLazy';
class App extends Component {
state = {
Lazy: () => null,
};
componentWillMount() {
setTimeout(async () => {
const Lazy = await import('./Lazy');
this.setState({ Lazy: Lazy.default });
}, 1500);
}
render() {
const { Lazy } = this.state;
return (
<div>
<NotLazy />
<Lazy />
</div>
);
}
}
Changes in Lazy component aren't applied.
Seems to be a duplicate of #303, no?
Seems like it is. I think it's definitely not webpack's bug. import() (I use dynamic-import plugin) is converted into require.ensure, and this example works nicely with HMR v1.3.1. Please note, I don't use react-router, and use webpack v.1. My example is as small as possible.
Yeah dynamic imports might be a place where our Babel plugin/Webpack loader for 3.0 should add a module.hot.accept() call. We'll definitely visit this before the full 3.0 release.
Most helpful comment
Yeah dynamic imports might be a place where our Babel plugin/Webpack loader for 3.0 should add a
module.hot.accept()call. We'll definitely visit this before the full 3.0 release.