Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The remoteEntry.js file is created by webpack without a hash on it. This means that browsers may cache it beyond when they should, or we need to find another way of cache busting it.

Answer: cache control headers or add a timestamp to the URL. Straight from the author’s mouth: https://github.com/module-federation/module-federation-examples/issues/491

Answer: cache control headers or add a timestamp to the URL. Suggestion: I think we’ll go with the latter, since that’s dead simple.

...

If someone loads the page (and manifest/remoteEntry.js) for an MFE and then someone does a deployment, in certain setups the previous versions of the files may be removed and no longer available. Think an S3 bucket that gets cleaned out each time there’s a deployment. If this happens, users viewing a previous version of the page will get 404 errors when trying to load chunks that no longer exist.

Answer: There are a few recommendations floating around online here.

  • Don’t delete old chunks on deploy

  • Have a file you can check to understand if your user is on the current version - presumably you poll this file before loading new chunks, or regularly? If it’s out of date, force a refresh.

  • When a chunk fails to load, force a refresh under the assumption that it’s because the user was on an outdated version of the app.

Suggestion: I think we could likely build in a mechanism to do the third fairly easily.