-
Notifications
You must be signed in to change notification settings - Fork 27.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add handling for domain to locale mapping #17771
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
buildDuration | 12.4s | 12.2s | -198ms |
nodeModulesSize | 63.4 MB | 63.4 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.453 | 2.418 | -0.03 |
/ avg req/sec | 1019.09 | 1033.97 | +14.88 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.453 | 1.41 | -0.04 |
/error-in-render avg req/sec | 1720.12 | 1773.09 | +52.97 |
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
677f882d2ed8..9b19.js gzip | 11.1 kB | 11.1 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-51c1c2f..7e91.js gzip | 7.23 kB | 7.22 kB | -11 B |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 58 kB | 58 kB | -11 B |
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | 6.9 kB | ✓ |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-87d379f..dule.js gzip | 6.29 kB | 6.28 kB | -10 B |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.9 kB | 52.9 kB | -10 B |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
index.html gzip | 1 kB | 1 kB | ✓ |
link.html gzip | 1.01 kB | 1.01 kB | -2 B |
withRouter.html gzip | 997 B | 995 B | -2 B |
Overall change | 3.01 kB | 3.01 kB | -4 B |
Diffs
Diff for 677f882d2ed8..4eeebf399.js
@@ -1879,8 +1879,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}),
delBasePath(as),
__N_SSG,
- this.locale,
- this.defaultLocale
+ this.locale
);
}
Diff for 677f882d2ed8..20.module.js
@@ -1390,8 +1390,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}),
delBasePath(as),
__N_SSG,
- this.locale,
- this.defaultLocale
+ this.locale
);
}
Diff for main-8e73dd2..68413e28f.js
@@ -353,9 +353,9 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
dynamicIds = data.dynamicIds,
isFallback = data.isFallback,
initialHeadData = data.head,
- locales = data.locales,
+ locales = data.locales;
+ var locale = data.locale,
defaultLocale = data.defaultLocale;
- var locale = data.locale;
var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
// So, this is how we do it in the client side at runtime
@@ -372,8 +372,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
asPath = (0, _router.delBasePath)(asPath);
}
- asPath = (0, _router.delLocale)(asPath, locale);
-
if (false) {
var localePathResult, _require, normalizeLocalePath;
}
@@ -1765,13 +1763,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
},
{
key: "getDataHref",
- value: function getDataHref(
- href,
- asPath,
- ssg,
- locale,
- defaultLocale
- ) {
+ value: function getDataHref(href, asPath, ssg, locale) {
var _this2 = this;
var _ref = (0, _parseRelativeUrl.parseRelativeUrl)(href),
@@ -1787,8 +1779,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var getHrefForSlug = function getHrefForSlug(path) {
var dataRoute = (0, _router.addLocale)(
(0, _getAssetPathFromRoute["default"])(path, ".json"),
- locale,
- defaultLocale
+ locale
);
return (0, _router.addBasePath)(
"/_next/data/"
@@ -1814,7 +1805,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
},
{
key: "prefetchData",
- value: function prefetchData(href, asPath, locale, defaultLocale) {
+ value: function prefetchData(href, asPath, locale) {
var _this3 = this;
var _ref3 = (0, _parseRelativeUrl.parseRelativeUrl)(href),
@@ -1829,8 +1820,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
href,
asPath,
true,
- locale,
- defaultLocale
+ locale
)) && // noop when data has already been prefetched (dedupe)
!document.querySelector(
'link[rel="'
Diff for main-f21a93d..8d.module.js
@@ -271,10 +271,9 @@
dynamicIds,
isFallback,
head: initialHeadData,
- locales,
- defaultLocale
+ locales
} = data;
- var { locale } = data;
+ var { locale, defaultLocale } = data;
var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
// So, this is how we do it in the client side at runtime
@@ -291,8 +290,6 @@
asPath = (0, _router.delBasePath)(asPath);
}
- asPath = (0, _router.delLocale)(asPath, locale);
-
if (false) {
var localePathResult, normalizeLocalePath;
}
@@ -1410,7 +1407,7 @@
* @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
*/
- getDataHref(href, asPath, ssg, locale, defaultLocale) {
+ getDataHref(href, asPath, ssg, locale) {
var { pathname: hrefPathname, query, search } = (0,
_parseRelativeUrl.parseRelativeUrl)(href);
var { pathname: asPathname } = (0,
@@ -1420,8 +1417,7 @@
var getHrefForSlug = path => {
var dataRoute = (0, _router.addLocale)(
(0, _getAssetPathFromRoute.default)(path, ".json"),
- locale,
- defaultLocale
+ locale
);
return (0, _router.addBasePath)(
"/_next/data/"
@@ -1444,7 +1440,7 @@
* @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
*/
- prefetchData(href, asPath, locale, defaultLocale) {
+ prefetchData(href, asPath, locale) {
var { pathname: hrefPathname } = (0,
_parseRelativeUrl.parseRelativeUrl)(href);
var route = normalizeRoute(hrefPathname);
@@ -1454,13 +1450,7 @@
_dataHref // Check if the route requires a data file
) =>
s.has(route) && // Try to generate data href, noop when falsy
- (_dataHref = this.getDataHref(
- href,
- asPath,
- true,
- locale,
- defaultLocale
- )) && // noop when data has already been prefetched (dedupe)
+ (_dataHref = this.getDataHref(href, asPath, true, locale)) && // noop when data has already been prefetched (dedupe)
!document.querySelector(
'link[rel="'
.concat(relPrefetch, '"][href^="')
Diff for index.html
@@ -6,7 +6,7 @@
<noscript data-n-css="true"></noscript>
<link
rel="preload"
- href="/_next/static/chunks/main-f21a93d0c5df5ac1d18d.module.js"
+ href="/_next/static/chunks/main-0e5b0f2c54131a0cba5f.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -85,13 +85,13 @@
src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
></script>
<script
- src="/_next/static/chunks/main-8e73dd227e768413e28f.js"
+ src="/_next/static/chunks/main-ceaeaf1cb88be54dd6a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/main-f21a93d0c5df5ac1d18d.module.js"
+ src="/_next/static/chunks/main-0e5b0f2c54131a0cba5f.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5472d08d2594eeebf399.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -6,7 +6,7 @@
<noscript data-n-css="true"></noscript>
<link
rel="preload"
- href="/_next/static/chunks/main-f21a93d0c5df5ac1d18d.module.js"
+ href="/_next/static/chunks/main-0e5b0f2c54131a0cba5f.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -90,13 +90,13 @@
src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
></script>
<script
- src="/_next/static/chunks/main-8e73dd227e768413e28f.js"
+ src="/_next/static/chunks/main-ceaeaf1cb88be54dd6a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/main-f21a93d0c5df5ac1d18d.module.js"
+ src="/_next/static/chunks/main-0e5b0f2c54131a0cba5f.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -126,13 +126,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5472d08d2594eeebf399.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -6,7 +6,7 @@
<noscript data-n-css="true"></noscript>
<link
rel="preload"
- href="/_next/static/chunks/main-f21a93d0c5df5ac1d18d.module.js"
+ href="/_next/static/chunks/main-0e5b0f2c54131a0cba5f.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -85,13 +85,13 @@
src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
></script>
<script
- src="/_next/static/chunks/main-8e73dd227e768413e28f.js"
+ src="/_next/static/chunks/main-ceaeaf1cb88be54dd6a8.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/main-f21a93d0c5df5ac1d18d.module.js"
+ src="/_next/static/chunks/main-0e5b0f2c54131a0cba5f.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -121,13 +121,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5472d08d2594eeebf399.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.17d128b4c94f527f314d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.d950dcaaa011f2b8e120.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e790c6fbd72bc7c72cc9.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.7s | |
nodeModulesSize | 63.4 MB | 63.4 MB |
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
677f882d2ed8..9b19.js gzip | 11.1 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-51c1c2f..7e91.js gzip | 7.23 kB | N/A | N/A |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..133b.js gzip | N/A | 11.1 kB | N/A |
main-faae5f7..727a.js gzip | N/A | 7.22 kB | N/A |
Overall change | 58 kB | 58 kB | -11 B |
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.9 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-87d379f..dule.js gzip | 6.29 kB | N/A | N/A |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.9 kB | N/A |
main-d2ce890..dule.js gzip | N/A | 6.28 kB | N/A |
Overall change | 52.9 kB | 52.9 kB | -10 B |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-409b283..e3ab.js gzip | 1.32 kB | 1.32 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.73 kB | 7.73 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-92d3016..dule.js gzip | 1.28 kB | 1.28 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.37 kB | 5.37 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js i18n/domain-locale-mapping | Change | |
---|---|---|---|
_error.js | 1.05 MB | 1.05 MB | |
404.html | 4.34 kB | 4.34 kB | ✓ |
hooks.html | 3.92 kB | 3.92 kB | ✓ |
index.js | 1.05 MB | 1.05 MB | |
link.js | 1.1 MB | 1.1 MB | |
routerDirect.js | 1.09 MB | 1.09 MB | |
withRouter.js | 1.09 MB | 1.09 MB | |
Overall change | 5.41 MB | 5.41 MB |
timneutkens
approved these changes
Oct 10, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #17370 this adds mapping of locales to domains and handles default locales for specific domains also allowing specifying which locales can be visited for each domain.
This PR also updates to output all statically generated pages under the locale prefix to make it easier to locate/lookup and to not redirect to the default locale prefixed path when no
accept-language
header is provided.