I ran into this issue as well but from a different direction. I was working on page transitions using React Transition Group and the <SwitchTransition> component, with GSAP to create page transitions and had this problem of the styles. As you mention everything works great on development but in production the problems start.
The only solution I found so far is not use modules as the styling approach and have a single CSS file, which is not ideal.
I ran into this issue as well but from a different direction. I was working on page transitions using React Transition Group and the
<SwitchTransition>
component, with GSAP to create page transitions and had this problem of the styles. As you mention everything works great on development but in production the problems start.The only solution I found so far is not use modules as the styling approach and have a single CSS file, which is not ideal.
I made this repo:
github.com/rhernandog/next-gsap-tr...
Here is live:
cranky-heyrovsky-83f0a9.netlify.app/