Next.JS -> A null PostCSS plugin was provided

1.6k views Asked by At

I'm using tailwindcss with Next.JS and getting this error on every first build. It doesn't make any problem but i don't know why i am getting this. Could you please help?

tailwind.css

    /* purgecss start ignore */
@tailwind  base;
@tailwind  components;
/* purgecss end ignore */
@tailwind  utilities;

postcss.config.js

 const purgecss = [
    '@fullhuman/postcss-purgecss',
    {
        // Specify the paths to all of the template files
        content: [
            './layout/**/*.{js,jsx,ts,tsx}',
            './compoents/**/*.{js,jsx,ts,tsx}',
            './pages/**/*.{js,jsx,ts,tsx}'
        ],
        // This is the function used to extract class names from the templates
        defaultExtractor: (content) => {
            // Capture as liberally as possible, including things like `h-(screen-1.5)`
            const broadMatches = content.match(/[^<>"'`\\s]*[^<>"'`\\s:]/g) || [];
            // Capture classes within other delimiters like .block(class="w-1/2") in Pug
            const innerMatches = content.match(/[^<>"'`\\s.()]*[^<>"'`\\s.():]/g) || [];
            return broadMatches.concat(innerMatches);
        },
    },
];
module.exports = {
    plugins: [
        'tailwindcss',
        process.env.NODE_ENV === 'production' ? purgecss : undefined,
        'postcss-preset-env',
    ],
};

tailwind.config.js

module.exports = {
  future: {
    removeDeprecatedGapUtilities: true,
    purgeLayersByDefault: true,
  },
  purge: [],
  theme: {
    extend: {},
  },
  variants: {},
  plugins: [],
}
1

There are 1 answers

0
LeslieOA On

From this article:

When you run npm run dev, you may get warnings about that a “null PostCSS plugin was provided”. That warning is an artifact of postcss.config.js returning undefined for instead of PurgeCSS when you are not in production. It can be safely ignored.