Importing a component in both _app.js and a page duplicates component css #19055
Replies: 7 comments 2 replies
-
I experience the same bug for a whole last year. |
Beta Was this translation helpful? Give feedback.
-
Created issue #20203 |
Beta Was this translation helpful? Give feedback.
-
I found dozens of similar issues
... and most of them was closed without any solution by balazsorban44! I have the same issue with [email protected], and still no solution. Three years since first issues about CSS duplicating. |
Beta Was this translation helpful? Give feedback.
-
We have been fighting this issue for a while. It's a really sad state of the whole CSS module's implementation. I thought that CSS modules could be the safest option to work with styles in Next 14 with the app folder. It seems not. Please attention to this poor long-term problem with developer UX @leerob 🙏 |
Beta Was this translation helpful? Give feedback.
-
This is definitely still an ongoing issue and we are running the latest version of Next.js at the time of writing (14.0.4). This is especially problematic as we are working on a large monorepo, where one package is our component library. Classes from this component library is being present in multiple bundles loaded from the client when moving from one route to another, resulting in unintended style overrides. We did have a hacky way of fixing this due to the nature of our component library, which allows us to dictate that any style overrides is to be done with CSS properties, but this solution is definitely not one that can be universally applied to everybody's use cases. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Repro: https://github.com/guilhermehn/next-duplicate-css-repro
Steps to reproduce
When Button is used by _app.js and a page it's css is duplicated.
Observations
Is this expected behaviour?
Beta Was this translation helpful? Give feedback.
All reactions