Skip to content

Commit

Permalink
fix: correct the next config optimizeCss type (#38879)
Browse files Browse the repository at this point in the history
`experimental.optimizeCss` from `next.config.js` can be an object containing the critters' option:

https://github.com/vercel/next.js/blob/70a53e0789c7e361f12139db6e124a5bb1d2afd9/packages/next/server/post-process.ts#L224-L232

The PR corrects the ajv schema and the type definition of `experimental.optimizeCss`.
  • Loading branch information
SukkaW committed Jul 21, 2022
1 parent 552620f commit fe4b711
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/next/server/config-schema.ts
Expand Up @@ -333,7 +333,14 @@ const configSchema = {
type: 'boolean',
},
optimizeCss: {
type: 'boolean',
oneOf: [
{
type: 'boolean',
},
{
type: 'object',
},
] as any,
},
outputFileTracingRoot: {
minLength: 1,
Expand Down
5 changes: 4 additions & 1 deletion packages/next/server/config-shared.ts
Expand Up @@ -94,7 +94,10 @@ export interface ExperimentalConfig {
isrFlushToDisk?: boolean
workerThreads?: boolean
pageEnv?: boolean
optimizeCss?: boolean
// optimizeCss can be boolean or critters' option object
// Use Record<string, unknown> as critters doesn't export its Option type
// https://github.com/GoogleChromeLabs/critters/blob/a590c05f9197b656d2aeaae9369df2483c26b072/packages/critters/src/index.d.ts
optimizeCss?: boolean | Record<string, unknown>
nextScriptWorkers?: boolean
scrollRestoration?: boolean
externalDir?: boolean
Expand Down

0 comments on commit fe4b711

Please sign in to comment.