Skip to content

Commit fe4b711

Browse files
authored
fix: correct the next config optimizeCss type (vercel#38879)
`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`.
1 parent 552620f commit fe4b711

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/next/server/config-schema.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,14 @@ const configSchema = {
333333
type: 'boolean',
334334
},
335335
optimizeCss: {
336-
type: 'boolean',
336+
oneOf: [
337+
{
338+
type: 'boolean',
339+
},
340+
{
341+
type: 'object',
342+
},
343+
] as any,
337344
},
338345
outputFileTracingRoot: {
339346
minLength: 1,

packages/next/server/config-shared.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ export interface ExperimentalConfig {
9494
isrFlushToDisk?: boolean
9595
workerThreads?: boolean
9696
pageEnv?: boolean
97-
optimizeCss?: boolean
97+
// optimizeCss can be boolean or critters' option object
98+
// Use Record<string, unknown> as critters doesn't export its Option type
99+
// https://github.com/GoogleChromeLabs/critters/blob/a590c05f9197b656d2aeaae9369df2483c26b072/packages/critters/src/index.d.ts
100+
optimizeCss?: boolean | Record<string, unknown>
98101
nextScriptWorkers?: boolean
99102
scrollRestoration?: boolean
100103
externalDir?: boolean

0 commit comments

Comments
 (0)