Replies: 1 comment
-
Hey. Was going through the same problem and came up with a solution following the docs here: Under dynamic urls. It basically goes like this
Using a promise resolution to add a timestamp param to remoteEntry calls prevents the browser from caching them. Since they are literally KBs in size that is not really a problem. And as a result of the promise resolution, all calls will return a fresh up-to-date remoteEntry file. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are facing a significant issue in production with Vite's Module Federation setup. When deploying new features to our microfrontend (MFE) applications, the browser caches the remoteEntry.js file. As a result, users continue to load outdated code even after a deployment. The issue is only resolved after the users manually clear their browser cache, which is causing a poor user experience in production environments.
Environment:
5.2.0
1.3.6
18.2.0
Steps involved:
What We Tried:
We attempted the following cache-busting techniques, but the issue persists:
Added the following to our
nginx.conf
to prevent caching:Added these meta tags in
index.html
to control browser caching:Despite these efforts, the browser continues to cache the
remoteEntry.js
file, and users do not see the updated code until they clear their cache.Impact:
This issue is affecting production environments where users are unable to access new features immediately after deployment. It forces them to clear their browser cache manually, which is not a viable solution.
Request:
We are seeking guidance or solutions from the Vite team on how to handle cache invalidation for
remoteEntry.js
when using the Vite Module Federation plugin. Specifically:Are there recommended strategies or configurations to ensure that
remoteEntry.js
always loads the latest version after a deployment?Is this a known issue with the
@originjs/vite-plugin-federation,
and if so, are there any fixes or workarounds available?Any assistance or advice would be greatly appreciated.
Additional Context:
Our use case involves multiple microfrontends communicating through Module Federation, with all components built using Vite and deployed to EKS. This issue is critical as it directly impacts the user experience in production.
Beta Was this translation helpful? Give feedback.
All reactions