From 9bf322503b3c1fdd94e28a399e72e7147e1d0c4d Mon Sep 17 00:00:00 2001 From: stefanprobst Date: Thu, 12 Aug 2021 17:42:57 +0200 Subject: [PATCH] Add missing fields to `NextConfig` type (#27974) This PR adds the `poweredByHeader` and `webpack` fields to the public `NextConfig` type. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes --- packages/next/build/entries.ts | 2 +- packages/next/server/config-shared.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/next/build/entries.ts b/packages/next/build/entries.ts index 90158e8596162..b9705c2d0a964 100644 --- a/packages/next/build/entries.ts +++ b/packages/next/build/entries.ts @@ -91,7 +91,7 @@ export function createEntrypoints( buildId, assetPrefix: config.assetPrefix, generateEtags: config.generateEtags ? 'true' : '', - poweredByHeader: config.poweredByHeader, + poweredByHeader: config.poweredByHeader ? 'true' : '', canonicalBase: config.amp.canonicalBase || '', basePath: config.basePath, runtimeConfig: hasRuntimeConfig diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index cbe5849346e5d..d3322d338e51a 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -48,6 +48,22 @@ export type NextConfig = { [key: string]: any } & { webpack5?: false excludeDefaultMomentLocales?: boolean + webpack?: + | (( + config: any, + context: { + dir: string + dev: boolean + isServer: boolean + buildId: string + config: NextConfigComplete + defaultLoaders: { babel: any } + totalPages: number + webpack: any + } + ) => any) + | null + trailingSlash?: boolean env?: { [key: string]: string } distDir?: string @@ -58,6 +74,7 @@ export type NextConfig = { [key: string]: any } & { generateEtags?: boolean pageExtensions?: string[] compress?: boolean + poweredByHeader?: boolean images?: ImageConfig devIndicators?: { buildActivity?: boolean