reactjsnext.jstailwind-csspostcss

Why next.js duplicates styles?


I have a next.js project. For styling I am using tailwind, scss modules and postcss. I have no overridden webpack configurations.

In development mode next.js injects styles in tags as expected, but in production it injects similar styles as *.css chunks and tag at the same time.

Next.js style duplication


Solution

  • Do you use Next.js' experimental optimizeCss with Tailwind or other CSS frameworks? It might be duplicating style as it injects inline CSS.