Next.JS -> 提供了一个 null PostCSS 插件

ker*_*aar 2 next.js tailwind-css

我将 tailwindcss 与 Next.JS 一起使用,并在每次第一次构建时都会出现此错误。它没有任何问题,但我不知道为什么我会得到这个。能否请你帮忙?

顺风.css

    /* purgecss start ignore */
@tailwind  base;
@tailwind  components;
/* purgecss end ignore */
@tailwind  utilities;
Run Code Online (Sandbox Code Playgroud)

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',
    ],
};
Run Code Online (Sandbox Code Playgroud)

tailwind.config.js

module.exports = {
  future: {
    removeDeprecatedGapUtilities: true,
    purgeLayersByDefault: true,
  },
  purge: [],
  theme: {
    extend: {},
  },
  variants: {},
  plugins: [],
}
Run Code Online (Sandbox Code Playgroud)

Les*_*eOA 5

从这篇文章:

\n
\n

当您运行 时npm run dev,您可能会收到有关提供了 \xe2\x80\x9cnull PostCSS 插件\xe2\x80\x9d 的警告。当您不在生产中时,该警告是postcss.config.js返回for 而不是 PurgeCSS的产物。undefined可以安全地忽略它。

\n
\n