Hot update fails after connecting to the webpack version of the module federation plugin
Describe the bug
After using the @module-federation/enhanced plugin, I found that hot update failed.
I checked issuse and found that someone mentioned this problem before, but it was for rspack. I also found someone raised this issue in the issue of webpack-dev-server
https://github.com/webpack/webpack/issues/11182
Reproduction
https://codesandbox.io/p/devbox/zai-xian-dai-ma-bian-ji-qi-forked-hr4kpz?migrateFrom=jhptvx
Used Package Manager
pnpm
System Info
macos:Sequoia 15.3.1
chrome:133.0.6943.143
Validations
- [x] Read the docs.
- [x] Read the common issues list.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Make sure this is a Module federation issue and not a framework-specific issue.
- [x] The provided reproduction is a minimal reproducible example of the bug.
ensure html plugin excludes its own remote entry chunk from being added to the html scripts otherwise 2 runtimes will collide and the hot update is injected into the wrong runtime.
ensure html plugin excludes its own remote entry chunk from being added to the html scripts otherwise 2 runtimes will collide and the hot update is injected into the wrong runtime.
I used the excludeChunks option in html-webpack-plugin to exclude remoteEntry, but hot updates still don't work. Moreover, my project is a remote (a producer) and does not consume resources from other projects.
Can you provide a repo
Can you provide a repo
Of course, I'd be happy to.
I will give you a compressed package of the project. I originally wanted to provide an online link, but CodeSandbox is not working well.
Please kindly download this project compressed package. Don't worry, it's absolutely safe.
Run the pnpm dev command, modify the file contents, and you will notice that the console prints logs indicating that hot updates have failed.
You need to add the chunk’s file name to excludeChunks.
new HtmlWebpackPlugin({
excludeChunks: ["webpack_app"],
});
You need to add the chunk’s file name to excludeChunks.
new HtmlWebpackPlugin({ excludeChunks: ["webpack_app"], });
I've already tried it, but it doesn't work.
Stale issue message
@ScriptedAlchemy Is there any progress, or did I miss some configuration?
Stale issue message
does host use its own remote somewhere (2 runtimes from same build on page)