Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing fields to NextConfig type #27974

Merged
merged 5 commits into from Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/build/entries.ts
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions packages/next/server/config-shared.ts
@@ -1,6 +1,7 @@
import os from 'os'
import { Header, Redirect, Rewrite } from '../lib/load-custom-routes'
import { ImageConfig, imageConfigDefault } from './image-config'
import type webpack from 'webpack'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type will be incorrect, config should likely be unknown or any in this particular case as webpack is compiled and it can be either webpack 4 or 5, the types referred here are webpack 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i had assumed it would pick up these types. i'll change to any then.


type NoOptionals<T> = {
[P in keyof T]-?: T[P]
Expand Down Expand Up @@ -48,6 +49,22 @@ export type NextConfig = { [key: string]: any } & {
webpack5?: false
excludeDefaultMomentLocales?: boolean

webpack?:
| ((
config: webpack.Configuration,
context: {
dir: string
dev: boolean
isServer: boolean
buildId: string
config: NextConfigComplete
defaultLoaders: { babel: webpack.RuleSetUseItem }
totalPages: number
webpack: typeof webpack
}
) => webpack.Configuration)
| null

trailingSlash?: boolean
env?: { [key: string]: string }
distDir?: string
Expand All @@ -58,6 +75,7 @@ export type NextConfig = { [key: string]: any } & {
generateEtags?: boolean
pageExtensions?: string[]
compress?: boolean
poweredByHeader?: boolean
images?: ImageConfig
devIndicators?: {
buildActivity?: boolean
Expand Down