rsnext/errors/postcss-function.md
Joe Haddad 32ded0539e
PostCSS Error When Exporting Function (#10242)
* PostCSS Error When Exporting Function

* Update postcss-function.md
2020-01-23 15:39:50 -05:00

617 B

PostCSS Configuration Is a Function

Why This Error Occurred

The project's custom PostCSS configuration exports a function instead of an object.

Possible Ways to Fix It

Adjust the custom PostCSS configuration to not export a function. Instead, return a plain object—if you need environment information, read it from process.env.

Before

module.exports = ({ env }) => ({
  plugins: {
    'postcss-plugin': env === 'production' ? {} : false,
  },
})

After

module.exports = {
  plugins: {
    'postcss-plugin': process.env.NODE_ENV === 'production' ? {} : false,
  },
}