Follow the step to install Tailwind.css with NextJS

Install Tailwind CSS with Next.js

Troubleshooting

If tailwind not work in prod. Definitely build step fails on file include.

tailwind.config.js

module.exports = {
  /*
  Make sure purge covered all your files
  (Especially _app.tsx)
   */
  + purge: ['./**/*.{js,ts,jsx,tsx}'],
  - purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
};