Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
fix postcss.config.js warnings (#12070)
Browse files Browse the repository at this point in the history
* update postcss.config.js to fix warnings

Return empty array if the condition is not met to avoid a null/undefined PostCSS plugin.

Related PR: vercel/next.js#11366

* style: correct linting error
  • Loading branch information
oddnavy authored Apr 21, 2020
1 parent 754408c commit 11bb15d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
module.exports = {
plugins: [
'tailwindcss',
process.env.NODE_ENV === 'production'
...(process.env.NODE_ENV === 'production'
? [
'@fullhuman/postcss-purgecss',
{
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
},
[
'@fullhuman/postcss-purgecss',
{
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
defaultExtractor: content =>
content.match(/[\w-/:]+(?<!:)/g) || [],
},
],
]
: undefined,
: []),
'postcss-preset-env',
],
}

0 comments on commit 11bb15d

Please sign in to comment.