Skip to content

Commit 693d0e3

Browse files
committed
Enable feature flag
1 parent f7ba546 commit 693d0e3

File tree

10 files changed

+52
-64
lines changed

10 files changed

+52
-64
lines changed

packages/next/build/entries.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ export function createEntrypoints(
9898
loadedEnvFiles: Buffer.from(JSON.stringify(loadedEnvFiles)).toString(
9999
'base64'
100100
),
101-
i18n: config.experimental.i18n
102-
? JSON.stringify(config.experimental.i18n)
103-
: '',
101+
i18n: config.i18n ? JSON.stringify(config.i18n) : '',
104102
}
105103

106104
Object.keys(pages).forEach((page) => {

packages/next/build/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export default async function build(
336336
}
337337
}),
338338
dataRoutes: [],
339-
i18n: config.experimental.i18n || undefined,
339+
i18n: config.i18n || undefined,
340340
}
341341

342342
await promises.mkdir(distDir, { recursive: true })
@@ -576,8 +576,8 @@ export default async function build(
576576
page,
577577
serverBundle,
578578
runtimeEnvConfig,
579-
config.experimental.i18n?.locales,
580-
config.experimental.i18n?.defaultLocale
579+
config.i18n?.locales,
580+
config.i18n?.defaultLocale
581581
)
582582

583583
if (workerResult.isHybridAmp) {
@@ -739,7 +739,7 @@ export default async function build(
739739
// n.b. we cannot handle this above in combinedPages because the dynamic
740740
// page must be in the `pages` array, but not in the mapping.
741741
exportPathMap: (defaultMap: any) => {
742-
const { i18n } = config.experimental
742+
const { i18n } = config
743743

744744
// Dynamically routed pages should be prerendered to be used as
745745
// a client-side skeleton (fallback) while data is being fetched.
@@ -878,7 +878,7 @@ export default async function build(
878878
pagesManifest[page] = relativeDest
879879
}
880880

881-
const { i18n } = config.experimental
881+
const { i18n } = config
882882
const isNotFound = ssgNotFoundPaths.includes(page)
883883

884884
// for SSG files with i18n the non-prerendered variants are
@@ -960,7 +960,7 @@ export default async function build(
960960
}
961961

962962
if (isSsg) {
963-
const { i18n } = config.experimental
963+
const { i18n } = config
964964

965965
// For a non-dynamic SSG page, we must copy its data file from export.
966966
if (!isDynamic) {

packages/next/build/webpack-config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,8 @@ export default async function getBaseWebpackConfig(
10041004
}),
10051005
'process.env.__NEXT_ROUTER_BASEPATH': JSON.stringify(config.basePath),
10061006
'process.env.__NEXT_HAS_REWRITES': JSON.stringify(hasRewrites),
1007-
'process.env.__NEXT_I18N_SUPPORT': JSON.stringify(
1008-
!!config.experimental.i18n
1009-
),
1010-
'process.env.__NEXT_I18N_DOMAINS': JSON.stringify(
1011-
config.experimental.i18n.domains
1012-
),
1007+
'process.env.__NEXT_I18N_SUPPORT': JSON.stringify(!!config.i18n),
1008+
'process.env.__NEXT_I18N_DOMAINS': JSON.stringify(config.i18n.domains),
10131009
'process.env.__NEXT_ANALYTICS_ID': JSON.stringify(config.analyticsId),
10141010
...(isServer
10151011
? {

packages/next/export/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export default async function exportApp(
283283
}
284284
}
285285

286-
const { i18n } = nextConfig.experimental
286+
const { i18n } = nextConfig
287287

288288
if (i18n && !options.buildExport) {
289289
throw new Error(

packages/next/next-server/server/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const defaultConfig: { [key: string]: any } = {
4545
basePath: '',
4646
sassOptions: {},
4747
trailingSlash: false,
48+
i18n: false,
4849
experimental: {
4950
cpus: Math.max(
5051
1,
@@ -62,7 +63,6 @@ const defaultConfig: { [key: string]: any } = {
6263
optimizeFonts: false,
6364
optimizeImages: false,
6465
scrollRestoration: false,
65-
i18n: false,
6666
},
6767
future: {
6868
excludeDefaultMomentLocales: false,
@@ -310,8 +310,8 @@ function assignDefaults(userConfig: { [key: string]: any }) {
310310
}
311311
}
312312

313-
if (result.experimental?.i18n) {
314-
const { i18n } = result.experimental
313+
if (result.i18n) {
314+
const { i18n } = result
315315
const i18nType = typeof i18n
316316

317317
if (i18nType !== 'object') {

packages/next/next-server/server/next-server.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export default class Server {
198198
? requireFontManifest(this.distDir, this._isLikeServerless)
199199
: null,
200200
optimizeImages: this.nextConfig.experimental.optimizeImages,
201-
defaultLocale: this.nextConfig.experimental.i18n?.defaultLocale,
201+
defaultLocale: this.nextConfig.i18n?.defaultLocale,
202202
}
203203

204204
// Only the `publicRuntimeConfig` key is exposed to the client side
@@ -298,8 +298,7 @@ export default class Server {
298298
parsedUrl.query = parseQs(parsedUrl.query)
299299
}
300300

301-
const { basePath } = this.nextConfig
302-
const { i18n } = this.nextConfig.experimental
301+
const { basePath, i18n } = this.nextConfig
303302

304303
if (basePath && req.url?.startsWith(basePath)) {
305304
// store original URL to allow checking if basePath was
@@ -577,7 +576,7 @@ export default class Server {
577576
// re-create page's pathname
578577
let pathname = `/${params.path.join('/')}`
579578

580-
const { i18n } = this.nextConfig.experimental
579+
const { i18n } = this.nextConfig
581580

582581
if (i18n) {
583582
const { host } = req?.headers || {}
@@ -1213,7 +1212,7 @@ export default class Server {
12131212
const locale = query.__nextLocale as string
12141213
delete query.__nextLocale
12151214

1216-
const { i18n } = this.nextConfig.experimental
1215+
const { i18n } = this.nextConfig
12171216
const locales = i18n.locales as string[]
12181217

12191218
let previewData: string | false | object | undefined
@@ -1243,7 +1242,7 @@ export default class Server {
12431242
)
12441243
}
12451244

1246-
if (this.nextConfig.experimental.i18n) {
1245+
if (this.nextConfig.i18n) {
12471246
return normalizeLocalePath(path, locales).pathname
12481247
}
12491248
return path

packages/next/server/next-dev-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ export default class DevServer extends Server {
534534

535535
const __getStaticPaths = async () => {
536536
const { publicRuntimeConfig, serverRuntimeConfig } = this.nextConfig
537-
const { locales, defaultLocale } = this.nextConfig.experimental.i18n || {}
537+
const { locales, defaultLocale } = this.nextConfig.i18n || {}
538538

539539
const paths = await this.staticPathsWorker.loadStaticPaths(
540540
this.distDir,

packages/next/telemetry/events/version.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ export function eventCliSession(
114114

115115
const userConfiguration = getNextConfig(phase, dir)
116116

117-
const { images, experimental } = userConfiguration || {}
118-
const { i18n } = experimental || {}
117+
const { images, i18n } = userConfiguration || {}
119118

120119
const payload: EventCliSessionStarted = {
121120
nextVersion: process.env.__NEXT_VERSION,
Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
module.exports = {
22
// target: 'experimental-serverless-trace',
3-
experimental: {
4-
i18n: {
5-
locales: ['nl-NL', 'nl-BE', 'nl', 'fr-BE', 'fr', 'en-US', 'en'],
6-
defaultLocale: 'en-US',
7-
domains: [
8-
{
9-
// used for testing, this should not be needed in most cases
10-
// as production domains should always use https
11-
http: true,
12-
domain: 'example.be',
13-
defaultLocale: 'nl-BE',
14-
locales: ['nl', 'nl-NL', 'nl-BE'],
15-
},
16-
{
17-
http: true,
18-
domain: 'example.fr',
19-
defaultLocale: 'fr',
20-
locales: ['fr-BE'],
21-
},
22-
],
23-
},
3+
i18n: {
4+
locales: ['nl-NL', 'nl-BE', 'nl', 'fr-BE', 'fr', 'en-US', 'en'],
5+
defaultLocale: 'en-US',
6+
domains: [
7+
{
8+
// used for testing, this should not be needed in most cases
9+
// as production domains should always use https
10+
http: true,
11+
domain: 'example.be',
12+
defaultLocale: 'nl-BE',
13+
locales: ['nl', 'nl-NL', 'nl-BE'],
14+
},
15+
{
16+
http: true,
17+
domain: 'example.fr',
18+
defaultLocale: 'fr',
19+
locales: ['fr-BE'],
20+
},
21+
],
2422
},
2523
}

test/integration/telemetry/next.config.i18n-images

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ module.exports = phase => {
44
sizes: [64, 128, 256, 512, 1024],
55
domains: ['example.com'],
66
},
7-
experimental: {
8-
i18n: {
9-
locales: ['en','nl','fr'],
10-
defaultLocale: 'en',
11-
domains: [
12-
{
13-
domain: 'example.com',
14-
defaultLocale: 'en'
15-
},
16-
{
17-
domain: 'example.fr',
18-
defaultLocale: 'fr'
19-
}
20-
]
21-
}
7+
i18n: {
8+
locales: ['en','nl','fr'],
9+
defaultLocale: 'en',
10+
domains: [
11+
{
12+
domain: 'example.com',
13+
defaultLocale: 'en'
14+
},
15+
{
16+
domain: 'example.fr',
17+
defaultLocale: 'fr'
18+
}
19+
]
2220
}
2321
}
2422
}

0 commit comments

Comments
 (0)