question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PostCSS plugin postcss-purgecss requires PostCSS 8.

See original GitHub issue

Describe the bug Config PurgeCSS with Gridsome Vuejs and gets this error

Screenshots image

Environment (please complete the following information):

   "postcss": "^8.2.9",
   "postcss-loader": "^5.2.0",
   "@fullhuman/postcss-purgecss": "^4.0.3",
   "@fullhuman/vue-cli-plugin-purgecss": "~4.0.3",

Additional context Config:

chainWebpack: config => {
    config.plugin('css').use(MiniCssExtractPlugin, [{
      filename: '[name].[hash].css',
    }])

    config.module
        .rule('css')
        .oneOf('normal')
        .use('postcss-loader')
        .tap(options => {
          options.plugins.unshift(...[
            require('cssnano'),
            purgecss({
              content: [`./public/**/*.html`, `./src/**/*.vue`],
              defaultExtractor(content) {
                const contentWithoutStyleBlocks = content.replace(
                    /<style[^]+?<\/style>/gi,
                    ""
                );
                return (
                    contentWithoutStyleBlocks.match(
                        /[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g
                    ) || []
                );
              },
              safelist: [
                /-(leave|enter|appear)(|-(to|from|active))$/,
                /^(?!(|.*?:)cursor-move).+-move$/,
                /^router-link(|-exact)-active$/,
                /data-v-.*/,
              ],
            })
          ])
          return options
        })

    config.performance.hints('warning')

  },

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

23reactions
amir-mlncommented, May 5, 2021

I had the same issue and nothing worked until i downgraded. npm i -D @fullhuman/postcss-purgecss@3.0.0 postcss@7.0.35

0reactions
Fflorielcommented, Nov 28, 2021

PurgeCSS version >4 will work with PostCSS 8. You will need to use version 3.0.0 with PostCSS 7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: PostCSS plugin tailwindcss requires PostCSS 8
I tried to uninstall postcss and tailwindcss but it does not work. Need help. Module build failed (from ./node_modules/postcss-loader/src/index.
Read more >
Error: PostCSS plugin postcss-purgecss requires PostCSS 8.
Error: PostCSS plugin postcss-purgecss requires PostCSS 8. solution: unintsall tailwind and install again. npm uninstall tailwindcss postcss autoprefixer.
Read more >
React with Tailwind CSS - Product Engineering
Error: PostCSS plugin tailwindcss requires PostCSS 8. You can also use Tailwind CSS that supports the previous version. npm install -D tailwindcss@npm:@ ...
Read more >
PostCSS - PurgeCSS
PurgeCSS is a tool to remove unused CSS from your project.
Read more >
“gulp PostCSS plugin tailwindcss requires PostCSS 8.” Code ...
npm uninstall tailwindcss postcss autoprefixer npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found