Module Federation with Tailwind
See original GitHub issueCurrent Behavior
Running dep-graph in the project where modules are imported via module federation, federated modules are not marked as a dependency.
This might be a problem because the Tailwind config file benefits from createGlobPatternsForDependencies
and therefore federated modules need to be added with a custom glob pattern.
Expected Behavior
createGlobPatternsForDependencies
should work with federated modules.
I just expect that one tailwind config should be enough.
Steps to Reproduce
Just create a module federation demo with nx and add tailwind to your host application. Try to use tailwind in federated modules or its child libraries.
Failure Logs
Environment
Nearly the same repo --> https://github.com/Coly010/example-nx-ng-mfe Angular based mfe’s.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Tailwind CSS + Module Federation - ng-journal
Tailwind CSS is a modern CSS utility library used by thousands of people. It allows to use predefined css classes directly inside the...
Read more >Building Micro Frontend with React & Module Federation
We will be creating a production-ready micro-front end app using React, Redux, Typescript, Tailwind CSS, React Router, and Webpack but the ...
Read more >r/javascript - Tailwind CSS + Module Federation [Angular]
The thing is Angular is a complete fremework. With bare React you can't create anything serious.
Read more >Tailwind CSS Gems, Micro-Frontends, 3 Biggest Failures
Micro-Frontends: What, why, and how. Micro-Frontend is super buzzed right now thanks to Webpack 5 and Module Federation. Learn how to use it ......
Read more >Module Federation - SurviveJS
To get started with module federation, let's build a small application that ... The styling portion uses Tailwind setup from the Eliminating Unused...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hey @sdedieu. I guess I found a way to workaround this situation without using apply in each component.
I created tailwind.config.js in root level of monorepo like that
then I removed of my shell and remote apps all styles using
and I also removed their own tailwind.config.js
So I created a lib called ui/common with globalTailwind.css that uses tailwind config
and finally added in shell and remote apps in their project.json
"styles": ["libs/ui/common/styles/globalTailwind.css"],
I dont know if it is a elegant method to solve this problem but now my remotes apps and shell are using tailwind utilities classes in their html files. Dark theme also works
@bressanelle It should work, but the downside is you lose the benefit of the Tailwind’s PostCSS Purge step where it reduces the size of your CSS bundle.
But it is a workaround.
I’m going to close this issue as this is a limitation of the tooling, and there is a workaround listed above.