Webpack 5 HMR Issue: Cannot set property './index.js' of undefined
See original GitHub issueBug report
What is the current behavior?
In Webpack 5, when I am using webpack-hot-middleware and HotModuleReplacementPlugin, then if I make a change in one of my JavaScript files and refresh my web app, I receive the error Uncaught TypeError: Cannot set property './index.js' of undefined in the file jsonp_chunk_loading.
If the current behavior is a bug, please provide the steps to reproduce.
I created a minimal repo to reproduce the issue here: https://github.com/smparsons/webpack-hmr-issue. Steps to reproduce are in the README file.
What is the expected behavior?
I would expect to not receive the above error after making a change in my code and refreshing my web app.
Other relevant information: webpack version: 5.0.0-beta.15 Node.js version: 11.10.1 Operating System: macOS Catalina Version 10.15 Additional tools:
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)

Top Related StackOverflow Question
Looks like same problem I have:
I’ve left a note here https://github.com/webpack/webpack/issues/10534 waiting for feedback.
@jantimon HTML looks like:
<script src="main.abf4d034b3614387dfd4.hot-update.js"></script>should not be there. Maybe filter out assets that havehotModuleReplacementordevelopmentflagged.I was able to fix it by adding these lines at https://github.com/jantimon/html-webpack-plugin/blob/96e0ae607afa7295c40d0a5073c791189def6337/index.js#L581-L583