pure scss/css lib not recognized by share scope #3923
-
Hi guys, our Module Federation ecosystem shares some Styleguide related libraries with the MF ShareScope. It works fine for component libraries but we face an issue with a pure scss/css library (defines basic resets, generic styleguide definitions, etc.). Adding the lib to the share scope was the initial go-to implementation but the lib does not show up in the actual runtime sharedMap of the remote/host. This generates an issue since each application in the ecosystem inject the lib when loaded to the runtime resulting in lots of duplicate css definitions in the browser. Is there a solution for this? All host/remotes work with css modules and proper abstraction -> Works fine. Only the shared lib provides issues since injected on a global level. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
make a js file and import that / share that who imports the styles? |
Beta Was this translation helpful? Give feedback.
make a js file and import that / share that who imports the styles?
CSS is a side effect of a javascript module.
Also sharing works by seeing what
import from
exists in the codebase, if it cannot see aimport from
that matches what the share key orrequest
matcher is, then its ignored / never seen becasue we hook into the module factory phase so we depend on the bundler consuming it to begin with then redirect the module