Search code examples
next.jspostcsstailwind-css

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


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.


Solution

  • 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]