DEV Community

Discussion on: Let's Build Micro Frontends with NextJS and Module Federation!

Collapse
 
suhanw profile image
Suhan Wijaya

Hi Yoav, thanks for this article. I noticed that you used the style attribute in your remote Nav component. Did you try using CSS Modules to style the Nav component, and how do you retrieve the link or style tags to insert into the SSR-ed HTML markup?

Next.js docs on CSS Modules support

Collapse
 
hamatoyogi profile image
Yoav Ganbar

Hi Shun,
Delighted you liked the article :-)
I have actually not tried using CSS modules in this example, but I believe it would be possible to do so. I might be mistaken, but I think that if you do use them in a remote component the CSS would be bundled with the federated component.

Well... went on and tried just so I can see that I was right, and indeed it does work :-)

There's no need to retrieve any link or style tag - the federated code has it all.
You can check out this branch that shows it working.

Hope this helps!

Collapse
 
suhanw profile image
Suhan Wijaya

Thanks for your prompt response!