Unverified Commit 8e34902f authored by fabb's avatar fabb Committed by GitHub

Update NextConfig type to not require experimental or future fields (#25517)

when typechecking next.config.js as described [in the docs](https://github.com/vercel/next.js/blob/canary/docs/basic-features/typescript.md#type-checking-nextconfigjs), an error would be thrown if `future` and `experimental` are missing. When using `Partial<>` in the type definition instead, it works as expected.

Fixes #25498

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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.

## Documentation / Examples

- [ ] Make sure the linting passes
parent a9725793
import { webpack } from 'next/dist/compiled/webpack/webpack' import { webpack } from 'next/dist/compiled/webpack/webpack'
import { NextConfig } from '../../../server/config' import { NextConfigComplete } from '../../../server/config-shared'
import { base } from './blocks/base' import { base } from './blocks/base'
import { css } from './blocks/css' import { css } from './blocks/css'
import { ConfigurationContext, pipe } from './utils' import { ConfigurationContext, pipe } from './utils'
...@@ -24,7 +24,7 @@ export async function build( ...@@ -24,7 +24,7 @@ export async function build(
assetPrefix: string assetPrefix: string
sassOptions: any sassOptions: any
productionBrowserSourceMaps: boolean productionBrowserSourceMaps: boolean
future: NextConfig['future'] future: NextConfigComplete['future']
isCraCompat?: boolean isCraCompat?: boolean
} }
): Promise<webpack.Configuration> { ): Promise<webpack.Configuration> {
......
import { webpack } from 'next/dist/compiled/webpack/webpack' import { webpack } from 'next/dist/compiled/webpack/webpack'
import { NextConfig } from '../../../server/config' import { NextConfigComplete } from '../../../server/config-shared'
export type ConfigurationContext = { export type ConfigurationContext = {
rootDirectory: string rootDirectory: string
...@@ -16,7 +16,7 @@ export type ConfigurationContext = { ...@@ -16,7 +16,7 @@ export type ConfigurationContext = {
sassOptions: any sassOptions: any
productionBrowserSourceMaps: boolean productionBrowserSourceMaps: boolean
future: NextConfig['future'] future: NextConfigComplete['future']
isCraCompat?: boolean isCraCompat?: boolean
} }
......
...@@ -46,7 +46,7 @@ interface ExportPageInput { ...@@ -46,7 +46,7 @@ interface ExportPageInput {
pagesDataDir: string pagesDataDir: string
renderOpts: RenderOpts renderOpts: RenderOpts
buildExport?: boolean buildExport?: boolean
serverRuntimeConfig: string serverRuntimeConfig: { [key: string]: any }
subFolders?: boolean subFolders?: boolean
serverless: boolean serverless: boolean
optimizeFonts: boolean optimizeFonts: boolean
......
...@@ -62,15 +62,18 @@ export type NextConfig = { [key: string]: any } & { ...@@ -62,15 +62,18 @@ export type NextConfig = { [key: string]: any } & {
sassOptions?: { [key: string]: any } sassOptions?: { [key: string]: any }
productionBrowserSourceMaps?: boolean productionBrowserSourceMaps?: boolean
optimizeFonts?: boolean optimizeFonts?: boolean
reactStrictMode?: boolean
publicRuntimeConfig?: { [key: string]: any }
serverRuntimeConfig?: { [key: string]: any }
future: { future?: {
/** /**
* @deprecated this options was moved to the top level * @deprecated this options was moved to the top level
*/ */
webpack5?: false webpack5?: false
strictPostcssConfiguration?: boolean strictPostcssConfiguration?: boolean
} }
experimental: { experimental?: {
cpus?: number cpus?: number
plugins?: boolean plugins?: boolean
profiling?: boolean profiling?: boolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment