webpack: Module Federation with Library Type Module (ESM) is not working
Bug report
What is the current behavior? When setting
new ModuleFederationPlugin({
name: "app1",
filename: "remoteEntry.js",
library: {
type: "module"
},
remotes: {
app2: "http://127.0.0.1:3002/remoteEntry.js",
},
exposes: {
"./Button": "./src/Button",
}
})
in module federation plugin config, the generate remote entry is not exporting anything. Or simply saying, consuming remote is not working.
If the current behavior is a bug, please provide the steps to reproduce.
(https://github.com/saravanan10393/mf-es-module)[Here is the reproduce repo] also (https://gist.github.com/saravanan10393/8185ef0a3e56f9419bbc5a299815aad4)[here is the generated removeEntry of app1.]
What is the expected behavior? The remoteEntry with ESM target support is needed.
Other relevant information: webpack version: 5.51.1 Node.js version: 14 Operating System: Mac Additional tools:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (5 by maintainers)
Is there a place or documentation where I can see all the library types? I’m passing through the same problem above, with same configuration, but I can’t find a place where there’s a detailed explanation of library types.
@ckken Try setting library.type to
window
It works with ESM? So I don’t need to check it?
i fine when use es5
is work, when use ES2015
the library is change~ and load failed