Error: Malformed PostCSS Configuration - NextJS

Error: Malformed PostCSS Configuration - NextJS

Hi, I faced this error while trying to incorporate "Dark Mode".

My project stack included : Next JS, Tailwind CSS.

This error could be mitigated in the following ways (atleast it worked for me):

  • Remove the "require" keyword in post.config.js file

postcss_2.png

postcss_1.png

  • In the tailwind.config.js file replace purge with content . The latest tailwind documentation suggest the same.

tailwind_2.png

tailwind_1.png

I hope it helps.

Thanks for reading.