From b7c2bd104d48781021d229dce7066fc9f36d6a1a Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Sun, 21 Aug 2022 17:25:10 -0600 Subject: [PATCH] fix meaninglessFileNames type in compiler options schema (#39698) # Bug I would assume that this should be generated from TypeScript, but based on the [original PR](https://github.com/vercel/next.js/pull/38498/files) it wasn't clear that there was a way to generate these automatically. Fixes the type of `styledComponents. topLevelImportPaths` and `styledComponents.meaninglessFileNames` so that it matches the [TypeScript type](https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts#L457). This was causing a warning here: ``` warn - Invalid next.config.js options detected: - The value at .compiler.styledComponents must be a boolean but it was an object. - The value at .compiler.styledComponents.meaninglessFileNames must be a boolean but it was an array. - The value at .compiler.styledComponents must match exactly one schema in oneOf. ``` ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` Co-authored-by: chaseadamsio <103162876+chaseadamsio@users.noreply.github.com> --- packages/next/server/config-schema.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/next/server/config-schema.ts b/packages/next/server/config-schema.ts index 3895876984c1bbe..db74156d29e3424 100644 --- a/packages/next/server/config-schema.ts +++ b/packages/next/server/config-schema.ts @@ -111,11 +111,16 @@ const configSchema = { type: 'boolean', }, topLevelImportPaths: { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, + oneOf: [ + { type: 'boolean' }, + { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + }, + ], }, ssr: { type: 'boolean', @@ -124,7 +129,16 @@ const configSchema = { type: 'boolean', }, meaninglessFileNames: { - type: 'boolean', + oneOf: [ + { type: 'boolean' }, + { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + }, + ], }, minify: { type: 'boolean',