forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PostCSS Error When Exporting Function (vercel#10242)
* PostCSS Error When Exporting Function * Update postcss-function.md
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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** | ||
|
||
```js | ||
module.exports = ({ env }) => ({ | ||
plugins: { | ||
'postcss-plugin': env === 'production' ? {} : false, | ||
}, | ||
}) | ||
``` | ||
|
||
**After** | ||
|
||
```js | ||
module.exports = { | ||
plugins: { | ||
'postcss-plugin': process.env.NODE_ENV === 'production' ? {} : false, | ||
}, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters