[📖] CSS Modules and useStyles$() hook approach incompatibility #7145
Labels
COMP: docs
Improvements or additions to documentation
STATUS-1: needs triage
New issue which needs to be triaged
Suggestion
Original docs URL are:
https://qwik.dev/docs/components/styles/#css-modules
https://qwik.dev/docs/components/styles/#usestyles
The context:
We have found that Qwik does not support the use of CSS Modules together with useStyles$()/useStylesScoped$() hooks to load only required CSS rules on the page, as the styles loaded from CSS Modules don't tree-shake (look at the screenshot below with identical styles in different chunks). This leads to CSS code duplication and increased bundle size.
As it turned out, useStyles$()/useStylesScoped$ hooks only supports plain CSS, but not CSS Modules.
I think this point should be better reflected in the documentation, because at the moment there is nothing about it and it is not entirely clear.
The text was updated successfully, but these errors were encountered: