Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
9a13dd34
Unverified
Commit
9a13dd34
authored
Oct 27, 2020
by
Joe Haddad
Committed by
GitHub
Oct 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable i18n feature flag (#18303)
parent
0f250514
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
52 additions
and
64 deletions
+52
-64
entries.ts
packages/next/build/entries.ts
+1
-3
index.ts
packages/next/build/index.ts
+6
-6
webpack-config.ts
packages/next/build/webpack-config.ts
+2
-6
index.ts
packages/next/export/index.ts
+1
-1
config.ts
packages/next/next-server/server/config.ts
+3
-3
next-server.ts
packages/next/next-server/server/next-server.ts
+5
-6
next-dev-server.ts
packages/next/server/next-dev-server.ts
+1
-1
version.ts
packages/next/telemetry/events/version.ts
+1
-2
next.config.js
test/integration/i18n-support/next.config.js
+19
-21
next.config.i18n-images
test/integration/telemetry/next.config.i18n-images
+13
-15
No files found.
packages/next/build/entries.ts
View file @
9a13dd34
...
...
@@ -98,9 +98,7 @@ export function createEntrypoints(
loadedEnvFiles
:
Buffer
.
from
(
JSON
.
stringify
(
loadedEnvFiles
)).
toString
(
'base64'
),
i18n
:
config
.
experimental
.
i18n
?
JSON
.
stringify
(
config
.
experimental
.
i18n
)
:
''
,
i18n
:
config
.
i18n
?
JSON
.
stringify
(
config
.
i18n
)
:
''
,
}
Object
.
keys
(
pages
).
forEach
((
page
)
=>
{
...
...
packages/next/build/index.ts
View file @
9a13dd34
...
...
@@ -336,7 +336,7 @@ export default async function build(
}
}),
dataRoutes
:
[],
i18n
:
config
.
experimental
.
i18n
||
undefined
,
i18n
:
config
.
i18n
||
undefined
,
}
await
promises
.
mkdir
(
distDir
,
{
recursive
:
true
})
...
...
@@ -576,8 +576,8 @@ export default async function build(
page
,
serverBundle
,
runtimeEnvConfig
,
config
.
experimental
.
i18n
?.
locales
,
config
.
experimental
.
i18n
?.
defaultLocale
config
.
i18n
?.
locales
,
config
.
i18n
?.
defaultLocale
)
if
(
workerResult
.
isHybridAmp
)
{
...
...
@@ -739,7 +739,7 @@ export default async function build(
// n.b. we cannot handle this above in combinedPages because the dynamic
// page must be in the `pages` array, but not in the mapping.
exportPathMap
:
(
defaultMap
:
any
)
=>
{
const
{
i18n
}
=
config
.
experimental
const
{
i18n
}
=
config
// Dynamically routed pages should be prerendered to be used as
// a client-side skeleton (fallback) while data is being fetched.
...
...
@@ -878,7 +878,7 @@ export default async function build(
pagesManifest
[
page
]
=
relativeDest
}
const
{
i18n
}
=
config
.
experimental
const
{
i18n
}
=
config
const
isNotFound
=
ssgNotFoundPaths
.
includes
(
page
)
// for SSG files with i18n the non-prerendered variants are
...
...
@@ -960,7 +960,7 @@ export default async function build(
}
if
(
isSsg
)
{
const
{
i18n
}
=
config
.
experimental
const
{
i18n
}
=
config
// For a non-dynamic SSG page, we must copy its data file from export.
if
(
!
isDynamic
)
{
...
...
packages/next/build/webpack-config.ts
View file @
9a13dd34
...
...
@@ -1004,12 +1004,8 @@ export default async function getBaseWebpackConfig(
}),
'process.env.__NEXT_ROUTER_BASEPATH'
:
JSON
.
stringify
(
config
.
basePath
),
'process.env.__NEXT_HAS_REWRITES'
:
JSON
.
stringify
(
hasRewrites
),
'process.env.__NEXT_I18N_SUPPORT'
:
JSON
.
stringify
(
!!
config
.
experimental
.
i18n
),
'process.env.__NEXT_I18N_DOMAINS'
:
JSON
.
stringify
(
config
.
experimental
.
i18n
.
domains
),
'process.env.__NEXT_I18N_SUPPORT'
:
JSON
.
stringify
(
!!
config
.
i18n
),
'process.env.__NEXT_I18N_DOMAINS'
:
JSON
.
stringify
(
config
.
i18n
.
domains
),
'process.env.__NEXT_ANALYTICS_ID'
:
JSON
.
stringify
(
config
.
analyticsId
),
...(
isServer
?
{
...
...
packages/next/export/index.ts
View file @
9a13dd34
...
...
@@ -283,7 +283,7 @@ export default async function exportApp(
}
}
const
{
i18n
}
=
nextConfig
.
experimental
const
{
i18n
}
=
nextConfig
if
(
i18n
&&
!
options
.
buildExport
)
{
throw
new
Error
(
...
...
packages/next/next-server/server/config.ts
View file @
9a13dd34
...
...
@@ -45,6 +45,7 @@ const defaultConfig: { [key: string]: any } = {
basePath
:
''
,
sassOptions
:
{},
trailingSlash
:
false
,
i18n
:
false
,
experimental
:
{
cpus
:
Math
.
max
(
1
,
...
...
@@ -62,7 +63,6 @@ const defaultConfig: { [key: string]: any } = {
optimizeFonts
:
false
,
optimizeImages
:
false
,
scrollRestoration
:
false
,
i18n
:
false
,
},
future
:
{
excludeDefaultMomentLocales
:
false
,
...
...
@@ -310,8 +310,8 @@ function assignDefaults(userConfig: { [key: string]: any }) {
}
}
if
(
result
.
experimental
?.
i18n
)
{
const
{
i18n
}
=
result
.
experimental
if
(
result
.
i18n
)
{
const
{
i18n
}
=
result
const
i18nType
=
typeof
i18n
if
(
i18nType
!==
'object'
)
{
...
...
packages/next/next-server/server/next-server.ts
View file @
9a13dd34
...
...
@@ -198,7 +198,7 @@ export default class Server {
?
requireFontManifest
(
this
.
distDir
,
this
.
_isLikeServerless
)
:
null
,
optimizeImages
:
this
.
nextConfig
.
experimental
.
optimizeImages
,
defaultLocale
:
this
.
nextConfig
.
experimental
.
i18n
?.
defaultLocale
,
defaultLocale
:
this
.
nextConfig
.
i18n
?.
defaultLocale
,
}
// Only the `publicRuntimeConfig` key is exposed to the client side
...
...
@@ -298,8 +298,7 @@ export default class Server {
parsedUrl
.
query
=
parseQs
(
parsedUrl
.
query
)
}
const
{
basePath
}
=
this
.
nextConfig
const
{
i18n
}
=
this
.
nextConfig
.
experimental
const
{
basePath
,
i18n
}
=
this
.
nextConfig
if
(
basePath
&&
req
.
url
?.
startsWith
(
basePath
))
{
// store original URL to allow checking if basePath was
...
...
@@ -577,7 +576,7 @@ export default class Server {
// re-create page's pathname
let
pathname
=
`/
${
params
.
path
.
join
(
'/'
)}
`
const
{
i18n
}
=
this
.
nextConfig
.
experimental
const
{
i18n
}
=
this
.
nextConfig
if
(
i18n
)
{
const
{
host
}
=
req
?.
headers
||
{}
...
...
@@ -1213,7 +1212,7 @@ export default class Server {
const
locale
=
query
.
__nextLocale
as
string
delete
query
.
__nextLocale
const
{
i18n
}
=
this
.
nextConfig
.
experimental
const
{
i18n
}
=
this
.
nextConfig
const
locales
=
i18n
.
locales
as
string
[]
let
previewData
:
string
|
false
|
object
|
undefined
...
...
@@ -1243,7 +1242,7 @@ export default class Server {
)
}
if
(
this
.
nextConfig
.
experimental
.
i18n
)
{
if
(
this
.
nextConfig
.
i18n
)
{
return
normalizeLocalePath
(
path
,
locales
).
pathname
}
return
path
...
...
packages/next/server/next-dev-server.ts
View file @
9a13dd34
...
...
@@ -534,7 +534,7 @@ export default class DevServer extends Server {
const
__getStaticPaths
=
async
()
=>
{
const
{
publicRuntimeConfig
,
serverRuntimeConfig
}
=
this
.
nextConfig
const
{
locales
,
defaultLocale
}
=
this
.
nextConfig
.
experimental
.
i18n
||
{}
const
{
locales
,
defaultLocale
}
=
this
.
nextConfig
.
i18n
||
{}
const
paths
=
await
this
.
staticPathsWorker
.
loadStaticPaths
(
this
.
distDir
,
...
...
packages/next/telemetry/events/version.ts
View file @
9a13dd34
...
...
@@ -114,8 +114,7 @@ export function eventCliSession(
const
userConfiguration
=
getNextConfig
(
phase
,
dir
)
const
{
images
,
experimental
}
=
userConfiguration
||
{}
const
{
i18n
}
=
experimental
||
{}
const
{
images
,
i18n
}
=
userConfiguration
||
{}
const
payload
:
EventCliSessionStarted
=
{
nextVersion
:
process
.
env
.
__NEXT_VERSION
,
...
...
test/integration/i18n-support/next.config.js
View file @
9a13dd34
module
.
exports
=
{
// target: 'experimental-serverless-trace',
experimental
:
{
i18n
:
{
locales
:
[
'nl-NL'
,
'nl-BE'
,
'nl'
,
'fr-BE'
,
'fr'
,
'en-US'
,
'en'
],
defaultLocale
:
'en-US'
,
domains
:
[
{
// used for testing, this should not be needed in most cases
// as production domains should always use https
http
:
true
,
domain
:
'example.be'
,
defaultLocale
:
'nl-BE'
,
locales
:
[
'nl'
,
'nl-NL'
,
'nl-BE'
],
},
{
http
:
true
,
domain
:
'example.fr'
,
defaultLocale
:
'fr'
,
locales
:
[
'fr-BE'
],
},
],
},
i18n
:
{
locales
:
[
'nl-NL'
,
'nl-BE'
,
'nl'
,
'fr-BE'
,
'fr'
,
'en-US'
,
'en'
],
defaultLocale
:
'en-US'
,
domains
:
[
{
// used for testing, this should not be needed in most cases
// as production domains should always use https
http
:
true
,
domain
:
'example.be'
,
defaultLocale
:
'nl-BE'
,
locales
:
[
'nl'
,
'nl-NL'
,
'nl-BE'
],
},
{
http
:
true
,
domain
:
'example.fr'
,
defaultLocale
:
'fr'
,
locales
:
[
'fr-BE'
],
},
],
},
}
test/integration/telemetry/next.config.i18n-images
View file @
9a13dd34
...
...
@@ -4,21 +4,19 @@ module.exports = phase => {
sizes: [64, 128, 256, 512, 1024],
domains: ['example.com'],
},
experimental: {
i18n: {
locales: ['en','nl','fr'],
defaultLocale: 'en',
domains: [
{
domain: 'example.com',
defaultLocale: 'en'
},
{
domain: 'example.fr',
defaultLocale: 'fr'
}
]
}
i18n: {
locales: ['en','nl','fr'],
defaultLocale: 'en',
domains: [
{
domain: 'example.com',
defaultLocale: 'en'
},
{
domain: 'example.fr',
defaultLocale: 'fr'
}
]
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment