vite-plugin-federation icon indicating copy to clipboard operation
vite-plugin-federation copied to clipboard

Issue with Chrome

Open jenextus opened this issue 1 year ago • 6 comments

Versions

  • vite-plugin-federation: ^1.3.6
  • vite: ^5.46

Steps to reproduce

  • CMD git clone [email protected]:originjs/vite-plugin-federation.git
  • CMD cd vite-plugin-federation/packages/examples/react-vite
  • CMD pnpm install
  • CMD pnpm run build:remotes && pnpm run serve:remotes
  • CMD pnpm run dev:hosts
  • open http://localhost:5000/

What is actually happening?

  • vite dev (host app) not working on Chrome (v128 ~ v129) but still working on vite build and another browser

jenextus avatar Sep 20 '24 04:09 jenextus

I can confirm that this is happening on other Chromium based browsers like Arc and Brave, but things are working correctly on Safari.

There doesn't appear to be any logs or errors in the browser dev console either.

I did notice that the div ends up empty in the browsers that don't work.

image

AlexThurston avatar Sep 20 '24 17:09 AlexThurston

Related to https://github.com/antfu/repro-chrome-v129 perhaps?

AlexThurston avatar Sep 20 '24 19:09 AlexThurston

We are encountering the same issue on both Chrome and Edge after the latest version 129 update. Applications in production that rely on the vite-plugin-federation plugin have gone down completely. Could the Vite-plugin-federation team kindly look into this as a priority and provide a quick fix?

n-anilrathod avatar Sep 23 '24 15:09 n-anilrathod

@n-anilrathod

Related to https://github.com/antfu/repro-chrome-v129 perhaps?

I believe @AlexThurston is correct. After investigating, this issue only seems to occur when HMR is enabled. Disabling HMR in development resolves the issue, but at the cost of losing Hot Reload functionality. It appears that this Chrome bug is fixed in the upcoming v130 release. I tested the beta version of Chrome with HMR enabled, and it worked without issues.

I have not encountered any problems with production builds or deployments—this only happens for me during development when Vite is running as a server with HMR enabled.

ahatton-hpt avatar Sep 24 '24 07:09 ahatton-hpt

I am using vite-plugin-top-level-await plugin as a temporary workaround.

SkyWalker653 avatar Sep 24 '24 08:09 SkyWalker653

@n-anilrathod

Related to https://github.com/antfu/repro-chrome-v129 perhaps?

I believe @AlexThurston is correct. After investigating, this issue only seems to occur when HMR is enabled. Disabling HMR in development resolves the issue, but at the cost of losing Hot Reload functionality. It appears that this Chrome bug is fixed in the upcoming v130 release. I tested the beta version of Chrome with HMR enabled, and it worked without issues.

I have not encountered any problems with production builds or deployments—this only happens for me during development when Vite is running as a server with HMR enabled.

@ahatton-hpt, the issue was not related to HMR as initially thought. It appears to be linked to circular imports, similar to what's described here: https://github.com/antfu/repro-chrome-v129. To resolve the issue, I added the vite-plugin-top-level-await, which seems to fix it. However, this plugin is considered optional for the latest Chrome versions. While the issue is temporarily resolved, I hope we won't encounter similar problems in the future.

n-anilrathod avatar Sep 24 '24 12:09 n-anilrathod

This issue has been resolved on chrome 130.

jenextus avatar Oct 23 '24 15:10 jenextus