Skip to content

Commit

Permalink
Update NextConfig type to not require experimental or future fields (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
fabb authored Jul 20, 2021
1 parent a972579 commit 8e34902
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/next/build/webpack/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 { css } from './blocks/css'
import { ConfigurationContext, pipe } from './utils'
Expand All @@ -24,7 +24,7 @@ export async function build(
assetPrefix: string
sassOptions: any
productionBrowserSourceMaps: boolean
future: NextConfig['future']
future: NextConfigComplete['future']
isCraCompat?: boolean
}
): Promise<webpack.Configuration> {
Expand Down
4 changes: 2 additions & 2 deletions packages/next/build/webpack/config/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { webpack } from 'next/dist/compiled/webpack/webpack'
import { NextConfig } from '../../../server/config'
import { NextConfigComplete } from '../../../server/config-shared'

export type ConfigurationContext = {
rootDirectory: string
Expand All @@ -16,7 +16,7 @@ export type ConfigurationContext = {
sassOptions: any
productionBrowserSourceMaps: boolean

future: NextConfig['future']
future: NextConfigComplete['future']

isCraCompat?: boolean
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface ExportPageInput {
pagesDataDir: string
renderOpts: RenderOpts
buildExport?: boolean
serverRuntimeConfig: string
serverRuntimeConfig: { [key: string]: any }
subFolders?: boolean
serverless: boolean
optimizeFonts: boolean
Expand Down
7 changes: 5 additions & 2 deletions packages/next/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ export type NextConfig = { [key: string]: any } & {
sassOptions?: { [key: string]: any }
productionBrowserSourceMaps?: boolean
optimizeFonts?: boolean
reactStrictMode?: boolean
publicRuntimeConfig?: { [key: string]: any }
serverRuntimeConfig?: { [key: string]: any }

future: {
future?: {
/**
* @deprecated this options was moved to the top level
*/
webpack5?: false
strictPostcssConfiguration?: boolean
}
experimental: {
experimental?: {
cpus?: number
plugins?: boolean
profiling?: boolean
Expand Down

0 comments on commit 8e34902

Please sign in to comment.