bundle-loader
bundle-loader copied to clipboard
a warning and a problem
warning as below:
an a problem is that when I start a fetch in React component's lifecycle, this fetch never ends.
@gitdust can you create minimum reproducible test repo?
actually I use this demo to code spliting,it seems that the problem is in this demo.My project is so big, I'll try my best to create a test repo.
I have the same problem, this is my solution.
this.state = {
isMounted: false
}
componentDidMount() {
this.setState({ isMounted: true })
}
componentWillUnmount() {
this.setState({ isMounted: false })
}
load(props) {
this.setState({
mod: null
})
props.load((mod) => {
if (this.state.isMounted) {
this.setState({
// handle both es imports and cjs
mod: mod.default ? mod.default : mod
})
}
})
}
I hope this works
@RedJue it worked for me,thanks very much. But still have any clue about this infinite fetch.