question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I lazy load remoteEntry.js

See original GitHub issue

I see remote app start loading after all the remoteEntry.js loaded if i put all the remotes to host’s webpack config. image

And in angular11-microfrontends, there is a method named loadRemoteEntry to load remoteEntry.js when I need it. But I should add the method to my project.

Is there any original webpack config to enable lazy load remoteEntry.js when I import the remote app? Just like this:

new ModuleFederationPlugin({
  remotes: {
    "microfeeg-app-child1": {
      url: "microfeeg_app_child1@/microfeeg-app-child1/remoteEntry.js",
      lazy: true,
     }
  },
}),

Thanks for replay.😁

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:30 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
popuguytheparrotcommented, Dec 1, 2021

How are the promises? Which plugin? I just indicate the path to the remoteEntry.js in the webpack module federation and that’s it. How to access the behavior of the plugin?

3reactions
ScriptedAlchemycommented, Sep 12, 2022

Upon looking into the webpack core code. Webpack will try/want to initialize all remotes known to it upfront. If you want to prevent that. You can create a proxy trap with promise new promise, basically resolve nothing and perform init manually when get() is fired.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack module federation lazy loading remoteEntry.js
When I enter page there are many requests for remoteEntry.js files for each app I have. I do not want to fetch it...
Read more >
Module Federation - webpack
Remote modules are modules that are not part of the current build but are loaded at runtime from a remote container. Loading remote...
Read more >
Webpack Module Federation (lazy load) - StackBlitz
Run the following commands in the root. directory. ```bash. npm i. npm run start. ``` Both `apps/root` and `apps/app2` are. independently deployed apps:....
Read more >
use-lazy-module-federation - NPM Package Overview - Socket
Start using Socket to analyze use-lazy-module-federation and its 0 ... This project was inspire from this sample to load dynamic remote ...
Read more >
Setting up remote components and services with webpack ...
<script src="http://localhost:3000/remote/remoteEntry.js"></script ... In above example we loaded remoteService synchronously in host application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found