Module federation should declare the remote entries with its location
See original GitHub issueFeature request
Let’s start from this example.
The app1 (shell/main/host) depends on app2. This dependency is declared in the webpack.config.js, but the location of app2 is declared in the /public/index.html
What is the expected behavior? I’d like to see them togheter, in the plugin options
new ModuleFederationPlugin({
name: "app1",
library: { type: "var", name: "app1" },
remotes: {
app2: {alias: "app2", remoteEntry: "http://localhost:3002/remoteEntry.js"}
},
shared: ["react", "react-dom"],
}),
What is motivation or use case for adding/changing the behavior? Easier to maintain
How should this be implemented in your opinion?
It should not change the core behaviour. It’s like a syntax sugar: just copy the remotes.{key}.remoteEntry to the index.html as <script>
Are you willing to work on this yourself? I’d love to. Not sure if I know enough about webpack’s implementation.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Module Federation - webpack
This plugin adds specific references to containers as externals and allows to import remote modules from these containers. It also calls the override...
Read more >Setting up remote components and services with webpack ...
Once basic setup is done, we can extend the remote module to create remote components. Create a component in remote application (src/RemoteApp.tsx). import ......
Read more >Tutorial - A Guide to Module Federation for Enterprise
Module Federation allows a JavaScript application to dynamically load code from another application and in the process, share dependencies. This ...
Read more >Webpack module federation is not working with eager shared ...
In order to make it work you need to change the way you are loading remote entry. Update your ModuleFederationPlugin config in ...
Read more >4 Ways to Use Dynamic Remotes in Module Federation
This pattern would also not work if you have multiple deployment stages with different URLs and environments. If we could not test remote...
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 Free
Top 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

I partly agree with u. Declare in the
index.htmlis not a good idea. But if declaring in the config file, the url of app2 will just be static. For example, we want to get the url of app2 from an admin backend.Actually, I want webpack do the favor for me to finish the last step, not fetching
remoteEntry.jsby my code.how? could u please give an example @zhangwilling