File tree Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -849,6 +849,7 @@ export default async function build(
849
849
loadConfig ( PHASE_PRODUCTION_BUILD , dir , {
850
850
// Log for next.config loading process
851
851
silent : false ,
852
+ validateConfig : true ,
852
853
reactProductionProfiling,
853
854
} ) ,
854
855
turborepoAccessTraceResult
Original file line number Diff line number Diff line change @@ -219,7 +219,10 @@ const nextDev = async (
219
219
// some set-ups that rely on listening on other interfaces
220
220
const host = options . hostname
221
221
222
- config = await loadConfig ( PHASE_DEVELOPMENT_SERVER , dir )
222
+ config = await loadConfig ( PHASE_DEVELOPMENT_SERVER , dir , {
223
+ validateConfig : true ,
224
+ silent : false ,
225
+ } )
223
226
224
227
if (
225
228
options . experimentalUploadTrace &&
Original file line number Diff line number Diff line change @@ -1156,12 +1156,14 @@ export default async function loadConfig(
1156
1156
customConfig,
1157
1157
rawConfig,
1158
1158
silent = true ,
1159
+ validateConfig,
1159
1160
onLoadUserConfig,
1160
1161
reactProductionProfiling,
1161
1162
} : {
1162
1163
customConfig ?: object | null
1163
1164
rawConfig ?: boolean
1164
1165
silent ?: boolean
1166
+ validateConfig ?: boolean
1165
1167
onLoadUserConfig ?: ( conf : NextConfig ) => void
1166
1168
reactProductionProfiling ?: boolean
1167
1169
} = { }
@@ -1275,13 +1277,16 @@ export default async function loadConfig(
1275
1277
) ) ,
1276
1278
} as NextConfig
1277
1279
1278
- if ( ! process . env . NEXT_MINIMAL ) {
1280
+ // Only validate the config against schema in:
1281
+ // * non minimal mode
1282
+ // * when `loadConfig` result is not silent
1283
+ if ( ! process . env . NEXT_MINIMAL && validateConfig ) {
1279
1284
// We only validate the config against schema in non minimal mode
1280
1285
const { configSchema } =
1281
1286
require ( './config-schema' ) as typeof import ( './config-schema' )
1282
1287
const state = configSchema . safeParse ( userConfig )
1283
1288
1284
- if ( state . success === false ) {
1289
+ if ( ! state . success ) {
1285
1290
// error message header
1286
1291
const messages = [ `Invalid ${ configFileName } options detected: ` ]
1287
1292
Original file line number Diff line number Diff line change @@ -100,7 +100,10 @@ export async function initialize(opts: {
100
100
const config = await loadConfig (
101
101
opts . dev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_SERVER ,
102
102
opts . dir ,
103
- { silent : false }
103
+ {
104
+ silent : opts . dev ,
105
+ validateConfig : ! opts . dev ,
106
+ }
104
107
)
105
108
106
109
let compress : ReturnType < typeof setupCompression > | undefined
You can’t perform that action at this time.
0 commit comments