module-federation-examples icon indicating copy to clipboard operation
module-federation-examples copied to clipboard

CSS for federated components is not loading server side on module-federation/nextjs-mf v7 or v8

Open K-Cheddar opened this issue 2 years ago • 4 comments

I demonstrated this using the examples repo. The below screenshots and video show "this is from checkout!" becomes red after load, resulting in a flash of unstyled content. This was demonstrated by forking the repo: https://github.com/K-Cheddar/module-federation-examples/tree/master/nextjs-ssr

Before JS loads: Screenshot 2023-11-10 at 10 21 40 AM

After JS loads: Screenshot 2023-11-10 at 10 21 54 AM

Video: v8fouc

The chunks that should include the css on the server is an empty array:

Screenshot 2023-11-10 at 11 14 09 AM

This is all run with the dependencies as given in the examples repo:

  "dependencies": {
    "@module-federation/nextjs-mf": "^8.1.0-canary.1",
    "lodash": "4.17.21",
    "next": "^13.5.4",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "webpack": "5.89.0"
  }

Also happens in 7.x and 8.1.0-canary.5

K-Cheddar avatar Nov 10 '23 15:11 K-Cheddar

is this in production mode? dev mode doesnt flush css chunks as its style-loader

ScriptedAlchemy avatar Nov 13 '23 23:11 ScriptedAlchemy

Yes, this is in production mode.

K-Cheddar avatar Nov 14 '23 14:11 K-Cheddar

Okay. We are rewriting federation and will circle back to this after rewrite.

ScriptedAlchemy avatar Nov 27 '23 07:11 ScriptedAlchemy

Thanks for letting me know. Do you have a rough eta for when you plan to release the rewrite?

K-Cheddar avatar Nov 28 '23 19:11 K-Cheddar