originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.39k stars 241 forks source link

feat: adds a workaround for a safari bug when loading modules async #617

Closed Tiagoperes closed 2 months ago

Tiagoperes commented 4 months ago

Description

Safari currently has a bug where, if the same module is imported twice or more simultaneously, it fails with a reference error.

This is actually a Webkit bug and is registered here: https://github.com/WebKit/WebKit/pull/24122

We don't know when this bug will be fixed, but we can work around it with a simple modification that prevents the same remote module from being imported twice. This PR implements this modification.

I'm not familiar with the source code of this lib, so I altered the function __federation_import everywhere I found it. Please, check.

What is the purpose of this pull request?

Before submitting the PR, please make sure you do the following

ruleeeer commented 3 months ago

It seems that this change is harmless, I will review the test issue when I have time