CSS modules duplicated when used with `next/dynamic`
See original GitHub issueWhat version of Next.js are you using?
10.2.2
What version of Node.js are you using?
14.16.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
When using next/dynamic
with CSS modules, we’ve found that CSS can be re-inserted (duplicated)
In our scenario, we have a simple <Text />
component that is already in use throughout the application. When we used <Text />
in a new component that was dynamically imported, styles for <Text />
were re-inserted.
These styles were inserted below all other styles, breaking some styles that rely on specificity - which is how we found this bug.
As a temporary workaround, we’ve removed that component from the dynamically loaded component.
Expected Behavior
Styles should not be re-inserted/duplicated.
To Reproduce
We haven’t been able to reliably reproduce this in a standalone repo.
We’ve looked and found some potentially similar issues, and this might be related: https://github.com/vercel/next.js/issues/20203.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:20
- Comments:13 (2 by maintainers)
Next.js
v12.1.0
still has problem.12.1.6 still has problem :