TypeError: Invalid PostCSS Plugin found at: plugins[0]

Sodhi saab picture Sodhi saab · Apr 8, 2020 · Viewed 9k times · Source

I cloned this repo https://github.com/tailwindcss/setup-examples/tree/master/examples/nextjs then I updated tailwind.config.js

  theme: {
    extend: {
      color: {
        primary: "#730000",
        secondry: "#efefef",
      },
    },
  },
  variants: {},
  plugins: [],
};

then run the command postcss css/tailwind.css -o generated.css terminal throws an error TypeError: Invalid PostCSS Plugin found at: plugins[0] can anyone please help me to fix it. Thank you.

Answer

Mashiro picture Mashiro · Apr 18, 2020

changed this

module.exports = {
  plugins: [
    "postcss-import",
    "tailwindcss",
    "autoprefixer",
  ]
};

to

module.exports = {
  plugins: [
    require("postcss-import"),
    require("tailwindcss"),
    require("autoprefixer"),
  ]
};

solved the

TypeError: Invalid PostCSS Plugin found at: plugins[0]