Chunk disappears on hot module reload
See original GitHub issueThe universal-component works fine initially, loading the chunk on route change, but whenever I update the lazy-loaded component (“Home.js”), it just disappears. universal-component doesn’t report any errors, and Webpack just tells me App and Home has been updated and everything is fine. Am I missing something in my config, or do you have any suggestions as to why it’s happening?
.babelrc
{
"presets": [["env", { "modules": false }], "react", "stage-2"],
"plugins": ["react-hot-loader/babel"]
}
index.js
import React from "react";
import { render } from "react-dom";
import { BrowserRouter } from "react-router-dom";
import { AppContainer } from "react-hot-loader";
import "./styles/App.scss";
import App from "./components/App";
const renderApp = Component => {
render(
<AppContainer>
<BrowserRouter>
<Component />
</BrowserRouter>
</AppContainer>,
document.getElementById("root")
);
};
renderApp(App);
if (module.hot) {
module.hot.accept(["./components/App"], () => {
renderApp(App);
});
}
App.js
import React, { Component } from "react";
import { Route } from "react-router-dom";
import universal from "react-universal-component";
// Sync components
import TopBar from "./shared/TopBar";
// Async components
const Home = universal(props =>
import(/* webpackChunkName: 'home' */ "./Home.js"), {
chunkName: "home"
}
);
class App extends Component {
render() {
return (
<div id="App">
<TopBar />
<main>
<Route path="/test" component={Home} />
</main>
</div>
);
}
}
export default App;
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to solve ChunkLoadError: Loading hot update chunk ...
js . It doesn't hot reload, I've to manually reload to get changes. I've set up a webpack-dev-server. Error ...
Read more >Webpack's Hot Module Replacement Feature Explained
After all, reloading means losing whatever process you're making on the UI: Any modal or dialog box you're working on will be gone....
Read more >Module Federation, Hot Prod Reloading, SSR & Next.js, for ...
First, I need to intercept the loadable manifest since next/dynamic uses it to look up an async chunk reference. If it is a...
Read more >Webpack 4 Tutorial 15: Webpack hot reloading - YouTube
Let us learn about webpack's hot reloadingSpecial discount for subscribers: Purchase full course at $9.99 - http://bit.ly/webpack4 ...
Read more >Hot Module Replacement - webpack
js', // Dev server client for web socket transport, hot and live reload logic 'webpack-dev-server/client/index.js?hot=true&live-reload=true', // Your entry './ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this happened to me until i added
babel-plugin-universal-import
to my build. kind of hidden in the middle of the readme, if you ask me 😛Doin a little cleanup. I’m going to close this. Feel free to re-open or continue the conversation if you discover any more relevant info.