Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.8k
Support#577
-
Welcome 🙏 Support questions, workaround, and implementation details questions can live here |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 7
any examples about versioning federation?
Replies: 72 comments 180 replies
-
@ScriptedAlchemy any guidance around deployment of a large module federated app? I am looking to do exactly what you demonstrated on the shared-routing example with a shell and various feature MFs. When serving it seems that the plug-in manages setting up the n number of servers on ports, but when doing an actual production deployment, what are the best practices and examples here? How do you configure what the different remotes might be served from and are there ways that certain remotes can build and deploy only their changes safely without the shell? Overall amazing work with this and really can’t wait to see more adoption of module federation in the community! |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
-
I'm working on federated unit tests so you'd be able to unit test the consumers / providers Mocking or making an API module similar to a state data contract you have with a backend API, then you know all you need to test against is calling this API and it responding with the right thing. if the contract breaks - the API breaks and the test fails |
BetaWas this translation helpful?Give feedback.
All reactions
-
@lili21 no article still but@jherr did an awesome video on the topic for the community:https://www.youtube.com/watch?v=ZFNxTy3fOO0 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yeah, I need to write the article on that one. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
To mimic the multiple ports i have, use an ingress / CDN to route asset resources to specific folders or separate applications. Federated unit tests work well (webpack build tests, then used code streaming & run jest against the bundle), also good ol cypress does the trick for some end to end smoke testing |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@ScriptedAlchemy how can we use code streaming? constreunited=(remotePath,name)=>`promise new Promise(resolve => { const fetch = require("node-fetch"); fetch('${remotePath}').then(response => response.text()).then(moduleCode => { require.cache[name] = moduleCode; resolve(moduleCode); }); })` |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@ScriptedAlchemy , first up, kudos to the team for the awesome work going on here. I built a test app in TypeScript (React micro-frontends - container, header, landing page, auth page etc.) You can see code and demohere. There are two issues I noticed and wanted to understand possible workarounds for these:
I'm attempting to workaround issue 1 by rendering a different set of microfrontends for the mobile app (albeit this is a sub-optimal approach). I will get back here on my experience with this workaround and how successful/effective the implementation turned out to be.
|
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@jacob-ebey , thank you for your reply. You are correct. I tried comparing header across a federation MFE, parcel MFE, monolith and plain index.html with 60px height set and they all looked the same. My apologies, I misunderstood the problem above |
BetaWas this translation helpful?Give feedback.
All reactions
-
Does one have a |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1❤️ 1
-
Yeah, you're right. That was the reason. How naïve of me! :) |
BetaWas this translation helpful?Give feedback.
All reactions
😄 2
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
thanks for sharing the link. It helped me alot. can you please describe how did you deployed it? Like did you deployed all the modules on a single server or different? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@mjRaza , I'm glad it was helpful. |
BetaWas this translation helpful?Give feedback.
All reactions
-
@ScriptedAlchemy, thank you for putting all the hard work on this amazing feature. Currently, I am trying to implement a module federation POC with the shell architecture. I noticed that module federation will disable tree-shaking on shared modules. Because of this , I am wondering is it true that we should only share non tree-shakable libraries only (e.g. react, react-dom but not lodash-es) ? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
It's not a hard rule but a good way to approach things. I'd only personally share modules if I know it'll exist in the consumer and you can't tree shake it. React Dom and React are perfect examples. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1❤️ 1
-
It really depends on what you need to share. Generally I share anything that depends on context or singletons. I'm not totally convinced that sharing things like a dsm is always effective as they can end up being quite large. So I usually prefer to share less code. Especially if I'm routing between pages or using progressive enhancements or lazy hydration. In those cases I'm not too upset by downloading like an extra 50kb if need be compared to having a higher initial hit Sharing is a dongle edge sword and I'd rely on bundle analyzer to help you decide what's worth sharing vs not Like material-ui/icons will add 5000 icons to your build 😂 not worth sharing haha |
BetaWas this translation helpful?Give feedback.
All reactions
😄 1❤️ 1
-
Hmm, this seems like something that it would be good to know more about. I know that some of the motivation for creating module federation in the first place was to be able to share code between apps, and only download the missing pieces. Right? At least I heard that in an interview recently :) |
BetaWas this translation helpful?Give feedback.
All reactions
-
any examples about versioning federation? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
You can find a solution utilizing unpkg here: Remote: Host: |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi@ScriptedAlchemy,@jacob-ebey! remote: host: and const ThemeToggleButton = React.lazy(() => import("mainApp/ThemeToggleButton")); const App = () => ( I would be very grateful if you can help and tell what I am doing wrong. Thanks |
BetaWas this translation helpful?Give feedback.
All reactions
-
@KFilipenkov going to need more of a repo case. Preferably a whole repo... |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@jacob-ebey thanks, fixed! everything is ok. just hanged to |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yep public path auto should solve it. There's also a plugin floating out there to allow global variables to be used in the remotes path so you can set the urls at runtime |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
OMG , thank you for this. |
BetaWas this translation helpful?Give feedback.
All reactions
-
how to handle various environments with the same file name |
BetaWas this translation helpful?Give feedback.
All reactions
-
hash the remoteEntry file name? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Go for it. There are plenty examples and community plugins posted throughout the help and issues here on this repo you can explore. I still say do not deploy two builds of the same app to the same environment. Seems like you're asking for trouble. Spin up a test environment. |
BetaWas this translation helpful?Give feedback.
All reactions
-
In practice, the ci system won't care about env that much. it just runs the build, and upload the assets to the CDN。the benefit of this strategy is the cd will be very fast for any enviroment, just need to deploy the Html file, no need for rebuilding. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'm not going to condone or support this. You do you. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'd suggest a sub domain like stage.cdn or some other path or use an ingress to route to specific assets |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi guys-@ScriptedAlchemy@jacob-ebey I am using webpack latest version, I am using bi directional MF approach. Only problem I am facing for each env I have to build the bundle seperately as in remote :{ } we are providing absolute path. Lot of discussion is going on finding any hack to provide the remote bundle url at run time not at build time.. Is there any solution for this so that I can use same bundle for all my env and can set remote bundle url dynamically at runtime? One folk suggested this plugin, will it work |
BetaWas this translation helpful?Give feedback.
All reactions
-
IDK, maybe give it a go and try it out? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Will webpack provide any solution to set remote url path in future release ? Or can you please help if you have already found any solution or hack ? |
BetaWas this translation helpful?Give feedback.
All reactions
-
use public path "auto" or pull one of the existing solutions and give it a go. |
BetaWas this translation helpful?Give feedback.
All reactions
-
does the module federation plugin provide any hooks? |
BetaWas this translation helpful?Give feedback.
All reactions
-
to access the plugin's option. |
BetaWas this translation helpful?Give feedback.
All reactions
-
There are no hooks. If you need the options somewhere you can do something like this in the apply of a new plugin: |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
Yep filter the constructor name or wrap the MF plugin in another abstraction so you can get the options passed to it. Then you can call the underlying plugin + do whatever else you need to |
BetaWas this translation helpful?Give feedback.
All reactions
-
I wonder how this one can be loaded the sync way? |
BetaWas this translation helpful?Give feedback.
All reactions
-
I thought the remote module can only be load in the async way. |
BetaWas this translation helpful?Give feedback.
All reactions
-
That's what the async bootstrap is there for. The loading is "hoisted" to that import statement therefor it can be used synchronously. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yep Jacob is right, the async bootstrap at the top is the solution, it allows anything async to be hoisted to the nearest promise, in this case its hoisting it to the import(bootstrap) since thats the nearest promise where webpack can pause the script execution and wait for something to happen |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
-
BetaWas this translation helpful?Give feedback.
All reactions
-
Upgrade to angular 12 - its god full support |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'm new to this and still figuring things out. I have module federation working great in my project. My question is around error capturing if a sub app is down. In other words I have shell calling child. In my development environment if I start the child app everything works as expected. But if I stop child app then shell app spins and gives me some errors as expected. My question is how do I handle this. I'm not entirely sure how I can capture the event error ofhttp://localhost:8081/remoteEntry.js (child app) not being available. I just want to be able to display a nice spinner while remote entry is loading and then display an error if the sub app is not available. Any help or suggestions would be appreciated. |
BetaWas this translation helpful?Give feedback.
All reactions
-
The Javascript for federated modules in development is served from your local server, but in production would be stored on S3 and served from there. And for S3 to be down would be a catastrophe for the entire Internet and is extremely unlikely. That being said, the Module Federation system in Webpack provides for a fallback where you can provide backup routes if the primary route changes. And also, depending on your framework, you can trap the issue with an error boundary and then use a backup mechanism, like asynchronously loaded code from an NPM module. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Understood, thank you for the reply. In my instance I'm using multiple server locations. So there is a possibility that my hosted provider server hosting (child app) could go down. While my shell app on aws is working just fine. I was reading more about error boundaries right before you replied. So at least I was on the right track. |
BetaWas this translation helpful?Give feedback.
All reactions
-
You should always host your static assets on something like S3, or Google's data service, or... Never serve them from a running server. And that's just outside of MF, that's just good practice. And honestly, those sites rarely go down. So if something happens it's probably because a bucket gets errantly deleted or something like that. IMHO, I wouldn't worry as much about that as I would putting up new code that is incompatible with the code consuming it (different methods, props, etc.) The plus side there is that you will probably take place right after a deploy and when that happens and ready to rollback immediately. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Understood. I'm investigating a solution for including app components from existing applications (old monoliths) into a new framework that uses newer tech stack which will eventually break down and take over the monolith. So the included child app is a server side application that is hosted at a facility not on AWS. I agree 100% with what you're saying if I was starting fresh. I did figure out the solution. It may not be elegant but it works.@jherr I think you'll appreciate this in particular because the proof of concept app I'm building is based on some MF videos you made. You may recognize the module names. importReact,{lazy,Suspense}from'react';importReactDOMfrom'react-dom';import'./index.css';constDogWidget=lazy(()=>import('host/DogWidget').catch(()=>import('./ErrorMessage')));constApp=()=>(<div><Suspensefallback={<div>Loading...</div>}><DogWidget/></Suspense></div>);ReactDOM.render(<App/>,document.getElementById('app')); |
BetaWas this translation helpful?Give feedback.
All reactions
-
Remotes can accept an array of urls in the event one origin is down. Best bet is Jack's resilient component pattern if you want afford critical components to be down. Otherwise you're betting on the CDN to be online. If it's down you'd likely have bigger problems though haha. Good logging practices are always encouraged so you're aware of any possible outage or failure. I also leave previous deploys on the CDN so that when deploying assets don't go missing mid deploy for users who already landed on the site |
BetaWas this translation helpful?Give feedback.
All reactions
-
I am currently developing a project respecting a microfrontend architecture using Webpack5 Module Federation and Angular. I am dealing with a somewhat anondin problem. Indeed, all my microfrontends (remote) work perfectly alone but when integrating them into the shell (host). I have an error that appears and shows some bugs on the application. ERROR TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. This error comes from Angular Core and especially when there is an integrated Angular Material component. The craziest thing about this problem is that it’s no longer there when I activate the chrome extension "Redux Dev Tools". There’s probably a problem with sharing libraries, but I don’t know where? My various configs of the host and remotes: Remote 1 : Remote 2: |
BetaWas this translation helpful?Give feedback.
All reactions
-
Sorry I don't on this one. Not an angular person but it looks like something might not be shared or it's not pulling the export off the object? Kind of like when you pass something wrong to react lazy and it can't find the default export? |
BetaWas this translation helpful?Give feedback.
All reactions
-
I am trying to runmulti-threaded-ssr, its complaining @module-federation/federated-runtime-plugin@* is not found in the npm registry, is the package json up to date? |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'll have to try running that example again. It's been a while |
BetaWas this translation helpful?Give feedback.
All reactions
-
ok sounds good, I think the @module-federation/federated-runtime plugin is not available in the npm registry or might have been changed? |
BetaWas this translation helpful?Give feedback.
All reactions
-
It says right in the README:
|
BetaWas this translation helpful?Give feedback.
All reactions
-
A Microsoft engineer released a open plugin that was based off our last public release which only worked pre-stable webpack. I have never used it so I can't say how reliable it is. Our streaming plugin is not open source for webpack stable |
BetaWas this translation helpful?Give feedback.
All reactions
😕 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi guys! I hope everyone is okay! Auth App Consume App I don't know if I understand what the error mean, but how can the container has already been initialized with a different share scope? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Are you using the low level api to initialize any dynamic remotes? I have only seen this when someone uses the vanilla api to initialize containers. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I figure it out! I was having a problem with webpack not finding the And that was creating the lost share scope. I removed the script and the error console disappeared. Everything seems to work now except I went back to the first problem haha Tks man! |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yes I am, I followed this example:https://github.com/module-federation/module-federation-examples/blob/master/nextjs-client-only/nextjs/components/LoadNextMF.jsx#L5 In my case 1. root NextJS app mounts a 2. react app (on a particular path), both of which use another 3. shared react app that shares several components. So when navigating from a NextJS route to React route this error occurs. Interestingly if we reload the app on the same URL, the error doesn't occur. Order of loading issue may be? Is it possible to avoid this error and just use the already initialized container? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
You'd want to use the nextjs example. Nextjs depends on nextjs-mf which is a paid plugin in other to make it work properly. You can only initialize a remote once. So if you're lazy load if additional remotes they cannot re-inject updated share scope into existing remotes that were already initialized. It causes object reference issues since you'd need to basically hot reload it to make the references cascade A workaround is to remove the remote and reinject them again which could cause them to have the updated share scopes |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'm working on a SPA, In which i have a application shell and number of micro-frontends that are loaded based on the route configuration. I have achieved this with the help of webpack's module federation plugin. Now i wanted to communicate UI state / data between micro-frontends, i have preferred Pub/Sub model of communication between the MFE's. But I don't want the Pub/Sub to be a global API whereas i wanted it to be local between the parent and child. The issue i'm facing is : While Sharing the Pub/Sub code between Micro Frontends, Every time a new instance of the Pub/Sub is being created, But I wanted a single instance of Pub/Sub between parent and child. The reason for the issue being the file is being completely loaded using webpack.require rather than sharing the instance alone. |
BetaWas this translation helpful?Give feedback.
All reactions
-
You can probably use sharing to share a single instance between the applications. Similar to how the shell shares service in shared-routing |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Thanks man! that worked :) |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi@nayeembadhusha,@ScriptedAlchemy I'm also struggling with similar issue. Could you help me to point with some examples to implement it right way ? Thanks |
BetaWas this translation helpful?Give feedback.
All reactions
-
use recoil shared as a singleton |
BetaWas this translation helpful?Give feedback.
All reactions
-
use recoil shared as a singleton |
BetaWas this translation helpful?Give feedback.
All reactions
-
Sorry@ScriptedAlchemy, got another questions. Can you suggest a best practice on using For instance, I have a However if set Is this actually an intended usage of |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hey Folks, I wanted to use dynamic federated module loading in a web worker, so I adapted some of the advanced API examples to work in a web workers.Example here in case it helps anyone else. Cheers, |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Has anyone made any progress with exposing components from the new nextJs 13app directory architecture (which replaces pages)? Currently, when I do this, I get I'm particularly interested in this because in modularises the server side code, rather than at the _app.tsx entry point (which is incompatible with module federation) |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi all! I have react app (localhost:3000), used as host. I have two remotes build with svelte. Both build with webpack 5, and module federation. On localhost everything works as expected, but when I deploy one remote (child) app on i.e. azure static websites, i.e. svelte2.remote.com and use it as remote on local host app - it gets svelte2.remote.com/remoteEntry.js, and after that it tries to get localhost:3000/585.js, instead of svelte2.remote.com/585.js. Any ideas on what am I doing wrong? Thanks! |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi Team-@ScriptedAlchemy / all Developers, I have worked with custom elements previously in angular. Now am trying to use Modular Federation approach to load mfe. I am using different versions in angular for different mfe's. I am using custom element approach in modular federation(https://www.angulararchitects.io/en/aktuelles/multi-framework-and-version-micro-frontends-with-module-federation-your-4-steps-guide/). As a Custom element it will work when we downloaded the build js files in browser and add the "tag or attribute" to dom. "Your help to understand me is highly appreciable" Thanks all for the support. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi@ScriptedAlchemy, team, We have a pretty big application that uses Marionette and Preact 8 with SSR. It has a big codebase, which is bundled by Webpack 4. Let's call itBase Repository. I see it as the following approach:
Will it work with SSR? Is there a simpler solution? The less we touchBase Repository application logic the better. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Am I correct we can utilizereact-loadable example? |
BetaWas this translation helpful?Give feedback.
All reactions
-
@ScriptedAlchemy , is there a way to check what a package version is resolved to? There is a bug that does not happen locally when application is running in dev mode, but happens only when all mfes are deployed. We suspect that this is a specific bug with one of the packages, but we cannot figure out the version of the package x that is used by the mfe in prod mode. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Console logwebpack_share_scopes in your build then check it on browser. If you expand into default.react.version.from == “oneWhoVendes” |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hello@ScriptedAlchemy I'm new in Next.js Module Federation, I just came up with issue about exposedPages, in Thanks |
BetaWas this translation helpful?Give feedback.
All reactions
-
Try extraOptions from my plugin readme. There’s a option to try and patch image resources. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Hello again@ScriptedAlchemy Currently working with nextjs module federations which uses tailwind as styling, in current module tailwind works pretty well but when I export for example page or component via this is my next1 const{ NextFederationPlugin}=require("@module-federation/nextjs-mf");/**@type {import('next').NextConfig} */constnextConfig={reactStrictMode:true,images:{domains:["avatars.githubusercontent.com"],},css:{modules:true,global:["./src/styles/global.css"],// Add the path to the styles.css file},webpack:(config,options)=>{const{ isServer}=options;config.plugins.push(newNextFederationPlugin({name:"next1",remotes:{next2:`next2@http://localhost:3001/_next/static/${isServer ?"ssr" :"chunks"}/remoteEntry.js`,},filename:"static/chunks/remoteEntry.js",exposes:{"./footer":"./src/components/Footer/index.tsx","./header":"./src/components/Header/index.tsx",},shared:{tailwindcss:{eager:true,singleton:true,},},}));returnconfig;},};module.exports=nextConfig; if any farther configurations are necessary, mention it and I'll send here Thanks |
BetaWas this translation helpful?Give feedback.
All reactions
-
Styles aren't shareable through the MF |
BetaWas this translation helpful?Give feedback.
All reactions
-
Styles can be shared |
BetaWas this translation helpful?Give feedback.
All reactions
-
If you dont import the css in the component though, then how would webpack know it supposed to load that. IF you import global at top of app, federation doesnt see any dep in the leaf node, so it doesnt load it. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I'm wondering if it's generally wise or a bad idea to spread the |
BetaWas this translation helpful?Give feedback.
All reactions
-
not a great idea, cant tree shake shared modules, generally i only share what i need to, not share everything always. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I am creating a POC for a new webstite with react and module federation with webpack. I have the following micro frontends, a shell, a menu and a filter bar, everything works as expected when the shell app put together the rest of apps. I want some guidance on how I can get the bundles generete of each micro frontend and render separetly in the old website app through a html script tag. This is because while I am developing the new site I want to be able to test some components in the old website with real clients. Thanks 🙏 |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thanks for the great work!. We're thriving with micro frontend because of your contribution. I'm usingModuleFederationPlugin and trying to intercept the chunk request to append query params by using the below function
This function used to be injected via entry option in the webpack config with the same name as we would give in the ModuleFederationPlugin. I have referred your suggestion from this postModule Federation and Custom startup code "The entry point naming trick takes advantage of module and chunk merging. It used to work fine but now this seems broken where the chunk merges incorrectly as it exports the startup code as the exported module. As it is mentioned by you as a dirty workaround, what is the recommended way of doing it ? Do you have any suggestion? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Google webpack module variables. You can patch or replace chunk load function at runtime on the fly |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks@ScriptedAlchemy for the suggestion.As this would require the replace chunk function to be part of the host and we would have to identify every request and replace if it is for the remote and skip otherwise so I thought it would be better if we scope thewebpack_get_script_filename function to be part of the remote Entry itself. Please let us know if there is such option available. |
BetaWas this translation helpful?Give feedback.
All reactions
-
There is a webpack concept ofComponents library as container. Do you recommend or have any examples related to this ? |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I've been struggling trying to implement HMR or a least hot reload usingthis React 18 SRR example using I tried many things from using Could you tell us how we could get at least hot reload or hot module replacement working with React Thank you so much 🙏 |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hello everyone, I'm trying to build a micro fe project with next 14 project and I'm kinda stuck whether it is possibile or not to create remotes with the standalone build. After build the next files are inside standalone folder (duh?) and yes the remotes are being generated but outside of it, and of course if I try to run my next apps with So my question is,does module federation supports next standalone build? In order to make remotes works, do I also need to consider the Here is the projecthttps://github.com/Staslios/federated-next-monorepo Sorry for the poor knowledge but I am still learning both Next and MF, any help is appreciated even external resources or yt videos, thank you all. |
BetaWas this translation helpful?Give feedback.
All reactions
-
youd need to host those folders publically as well so they can be accesses over the internet etc. |
BetaWas this translation helpful?Give feedback.
All reactions
😄 1
-
@ScriptedAlchemy Thank you for your kind answer. In simpler words I should consider a separate process build for app and remotes ? Something like a standalone build for the app and then a secondary build for the remotes only, I cannot make all in one build standalone + client remote + ssr remotes, correct me if I'm mistaken. I saw the other demos you made but withvanilla react, you set like a webpack.shared, webpack.client and webpack.remote, I should proceed with something similar for next ? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Just cp the files into standalone directory if they are in wrong place |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Hi, I have been trying to integrate microfrontends in our monolithic application, and I have been indecisive about using static imports across remotes, because of error handling reasons similar toabove. If I take the above example, With dynamic federation Now, with static federation, what would be the equivalent way to show an error state? I have the following questions:- Question 2: I have a lot of legacy code, so static imports might be the only way to migrate while still being independently deployable. Along these lines, I am planning to statically import hooks and utils from remotes as well. My doubt is that if I import 10 hooks in a chunk, I expect that webpack will create a new chunk for each of these 10 hooks. This might mean that I will have 10 more network calls for loading a chunk, compared to what I had in the monolith. I would like to know firstly if this is a valid concern. If yes, is there a way to "group" multiple exposes to the same chunk to avoid too many network calls. I would also like to confirm if this is supported out of the box by webpack Module federation, or would I have to do some custom plugin magic to support my use-case? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Error load remote hook via runtime plugin. Check our doc site or runtime plugin dir in this repo |
BetaWas this translation helpful?Give feedback.

