You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run config deprecation checks only on user-provided configuration (#82613)
The deprecation warning code is fairly brittle right now since there's a
mixture of calling things with `userConfig` and `result`. It was assumed
that `userConfig` was the actual user-provided configuration, but it
turns out it's actually the default configuration when a user
configuration isn't specified.
This moves all the deprecation checks to be before we actually do any
sort of merging. This restores the intent behind `userConfig` and will
prevent deprecation warnings from being logged due to defaults.
Alternative to #82593
`\`experimental.dynamicIO\` has been renamed to \`experimental.cacheComponents\`. Please update your ${configFileName} file accordingly.`,
117
+
silent
118
+
)
119
+
}
120
+
121
+
warnOptionHasBeenDeprecated(
122
+
userConfig,
123
+
'experimental.instrumentationHook',
124
+
`\`experimental.instrumentationHook\` is no longer needed, because \`instrumentation.js\` is available by default. You can remove it from ${configFileName}.`,
125
+
silent
126
+
)
127
+
128
+
warnOptionHasBeenDeprecated(
129
+
userConfig,
130
+
'experimental.after',
131
+
`\`experimental.after\` is no longer needed, because \`after\` is available by default. You can remove it from ${configFileName}.`,
132
+
silent
133
+
)
134
+
135
+
warnOptionHasBeenDeprecated(
136
+
userConfig,
137
+
'devIndicators.appIsrStatus',
138
+
`\`devIndicators.appIsrStatus\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
139
+
silent
140
+
)
141
+
142
+
warnOptionHasBeenDeprecated(
143
+
userConfig,
144
+
'devIndicators.buildActivity',
145
+
`\`devIndicators.buildActivity\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
146
+
silent
147
+
)
148
+
149
+
warnOptionHasBeenDeprecated(
150
+
userConfig,
151
+
'devIndicators.buildActivityPosition',
152
+
`\`devIndicators.buildActivityPosition\` has been renamed to \`devIndicators.position\`. Please update your ${configFileName} file accordingly.`,
153
+
silent
154
+
)
155
+
156
+
// i18n deprecation for App Router
157
+
if(userConfig.i18n){
158
+
consthasAppDir=Boolean(findDir(dir,'app'))
159
+
if(hasAppDir){
160
+
warnOptionHasBeenDeprecated(
161
+
userConfig,
162
+
'i18n',
163
+
`i18n configuration in ${configFileName} is unsupported in App Router.\nLearn more about internationalization in App Router: https://nextjs.org/docs/app/building-your-application/routing/internationalization`,
`\`experimental.instrumentationHook\` is no longer needed, because \`instrumentation.js\` is available by default. You can remove it from ${configFileName}.`,
539
-
silent
540
-
)
541
-
542
-
warnOptionHasBeenDeprecated(
543
-
result,
544
-
'experimental.after',
545
-
`\`experimental.after\` is no longer needed, because \`after\` is available by default. You can remove it from ${configFileName}.`,
546
-
silent
547
-
)
548
-
549
-
warnOptionHasBeenDeprecated(
550
-
result,
551
-
'devIndicators.appIsrStatus',
552
-
`\`devIndicators.appIsrStatus\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
553
-
silent
554
-
)
555
-
556
-
warnOptionHasBeenDeprecated(
557
-
result,
558
-
'devIndicators.buildActivity',
559
-
`\`devIndicators.buildActivity\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
`The \`devIndicators\` option \`buildActivityPosition\` ("${result.devIndicators.buildActivityPosition}") conflicts with \`position\` ("${result.devIndicators.position}"). Using \`buildActivityPosition\` ("${result.devIndicators.buildActivityPosition}") for backward compatibility.`
577
-
)
592
+
if(!silent){
593
+
Log.warnOnce(
594
+
`The \`devIndicators\` option \`buildActivityPosition\` ("${result.devIndicators.buildActivityPosition}") conflicts with \`position\` ("${result.devIndicators.position}"). Using \`buildActivityPosition\` ("${result.devIndicators.buildActivityPosition}") for backward compatibility.`
`i18n configuration in ${configFileName} is unsupported in App Router.\nLearn more about internationalization in App Router: https://nextjs.org/docs/app/building-your-application/routing/internationalization`,
753
-
silent
754
-
)
755
-
}
756
-
757
765
const{ i18n }=result
758
766
consti18nType=typeofi18n
759
767
@@ -1290,6 +1298,9 @@ export default async function loadConfig(
0 commit comments