Skip to content
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

Ensure domain locales are redirected client-side #20562

Merged
merged 17 commits into from
Dec 30, 2020

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Dec 29, 2020

This ensures we detect domain specific locales and redirect them client-side. Tests have been added in the i18n suite to ensure the domain redirect is applied correctly during a client-side navigation

Fixes: #19174

@vercel vercel bot temporarily deployed to Preview December 29, 2020 07:51 Inactive
@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@vercel vercel bot temporarily deployed to Preview December 29, 2020 16:10 Inactive
@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@vercel vercel bot temporarily deployed to Preview December 29, 2020 16:34 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 29, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 10.1s 10s -90ms
nodeModulesSize 82.7 MB 82.7 MB ⚠️ +4.4 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 2.008 1.986 -0.02
/ avg req/sec 1245.16 1258.8 +13.64
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.17 1.216 ⚠️ +0.05
/error-in-render avg req/sec 2136.79 2056.45 ⚠️ -80.34
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..68d0.js gzip 12.7 kB 12.8 kB ⚠️ +115 B
framework.HASH.js gzip 39 kB 39 kB
main-8d1eb02..37d1.js gzip 6.56 kB 6.57 kB ⚠️ +13 B
webpack-95c2..e870.js gzip 751 B 751 B
Overall change 59 kB 59.1 kB ⚠️ +128 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-d3..23f6.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-0d19cb6..5497.js gzip 1.28 kB 1.28 kB
_error-85785..a9f3.js gzip 3.44 kB 3.44 kB
hooks-42456f..0c06.js gzip 887 B 887 B
index-8081ce..e44f.js gzip 227 B 227 B
link-0ab9f83..fa00.js gzip 1.61 kB 1.61 kB
routerDirect..c3d8.js gzip 303 B 303 B
withRouter-0..a68e.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 614 B 613 B -1 B
link.html gzip 619 B 619 B
withRouter.html gzip 607 B 607 B
Overall change 1.84 kB 1.84 kB -1 B

Diffs

Diff for 677f882d2ed8..413dc7645.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1505,7 +1510,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1529,6 +1535,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1744,6 +1751,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _this$locales,
                     parsedAs,
                     localePathResult,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1794,7 +1803,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 19;
                               break;
                             }
 
@@ -1851,6 +1860,47 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                           case 14:
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
+                              this.locale
+                            ); // if we are navigating to a domain locale ensure we redirect to the
+                            // correct domain
+
+                            if (
+                              !(
+                                detectedDomain &&
+                                self.location.hostname !== detectedDomain.domain
+                              )
+                            ) {
+                              _context.next = 19;
+                              break;
+                            }
+
+                            asNoBasePath = delBasePath(as);
+                            window.location.href = "http"
+                              .concat(detectedDomain.http ? "" : "s", "://")
+                              .concat(detectedDomain.domain)
+                              .concat(
+                                addBasePath(
+                                  ""
+                                    .concat(
+                                      this.locale ===
+                                        detectedDomain.defaultLocale
+                                        ? ""
+                                        : "/".concat(this.locale)
+                                    )
+                                    .concat(
+                                      asNoBasePath === "/" ? "" : asNoBasePath
+                                    ) || "/"
+                                )
+                              );
+                            return _context.abrupt(
+                              "return",
+                              new Promise(function() {})
+                            );
+
+                          case 19:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1895,7 +1945,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 35;
                               break;
                             }
 
@@ -1916,7 +1966,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 35:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1926,30 +1976,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 37;
+                            _context.next = 40;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 40:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 43;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 43:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 51;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 47:
+                            _context.prev = 47;
+                            _context.t0 = _context["catch"](37);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 51:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1991,7 +2041,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 74;
                               break;
                             }
 
@@ -2014,7 +2064,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 73;
                               break;
                             }
 
@@ -2025,7 +2075,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2056,11 +2106,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 71:
+                            _context.next = 74;
                             break;
 
-                          case 68:
+                          case 73:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2076,14 +2126,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 74:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 75;
+                            _context.next = 78;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2092,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 78:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2107,7 +2157,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 90;
                               break;
                             }
 
@@ -2116,7 +2166,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 83;
+                              _context.next = 88;
                               break;
                             }
 
@@ -2126,7 +2176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 83;
+                              _context.next = 88;
                               break;
                             }
 
@@ -2142,14 +2192,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 88:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 90:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2160,7 +2210,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 95;
                             return this.set(
                               route,
                               pathname,
@@ -2172,9 +2222,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 95:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 98;
                               break;
                             }
 
@@ -2186,7 +2236,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 98:
                             if (false) {
                             }
 
@@ -2200,21 +2250,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 104:
+                            _context.prev = 104;
+                            _context.t1 = _context["catch"](75);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 108;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 108:
                             throw _context.t1;
 
-                          case 104:
+                          case 109:
                           case "end":
                             return _context.stop();
                         }
@@ -2223,8 +2273,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 99]
+                      [37, 47],
+                      [75, 104]
                     ]
                   );
                 })
Diff for main-0bc58ce..f930fc47a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -716,7 +717,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 11.9s 11.7s -219ms
nodeModulesSize 82.7 MB 82.7 MB ⚠️ +4.4 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..68d0.js gzip 12.7 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-8d1eb02..37d1.js gzip 6.56 kB N/A N/A
webpack-95c2..e870.js gzip 751 B 751 B
677f882d2ed8..4ea6.js gzip N/A 12.8 kB N/A
main-8448bb4..a494.js gzip N/A 6.57 kB N/A
Overall change 59 kB 59.1 kB ⚠️ +128 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-d3..23f6.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-0d19cb6..5497.js gzip 1.28 kB 1.28 kB
_error-85785..a9f3.js gzip 3.44 kB 3.44 kB
hooks-42456f..0c06.js gzip 887 B 887 B
index-8081ce..e44f.js gzip 227 B 227 B
link-0ab9f83..fa00.js gzip 1.61 kB 1.61 kB
routerDirect..c3d8.js gzip 303 B 303 B
withRouter-0..a68e.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.16 MB ⚠️ +641 B
Commit: 0ce8690

@ijjk ijjk marked this pull request as ready for review December 29, 2020 16:50
@vercel vercel bot temporarily deployed to Preview December 29, 2020 19:07 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 29, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 10.8s 10.8s ⚠️ +13ms
nodeModulesSize 82.7 MB 82.7 MB ⚠️ +4.4 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 2.208 2.22 ⚠️ +0.01
/ avg req/sec 1132.39 1126.31 ⚠️ -6.08
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.576 1.592 ⚠️ +0.02
/error-in-render avg req/sec 1586.1 1569.91 ⚠️ -16.19
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..68d0.js gzip 12.7 kB 12.8 kB ⚠️ +115 B
framework.HASH.js gzip 39 kB 39 kB
main-8d1eb02..37d1.js gzip 6.56 kB 6.57 kB ⚠️ +13 B
webpack-95c2..e870.js gzip 751 B 751 B
Overall change 59 kB 59.1 kB ⚠️ +128 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-d3..23f6.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-0d19cb6..5497.js gzip 1.28 kB 1.28 kB
_error-85785..a9f3.js gzip 3.44 kB 3.44 kB
hooks-42456f..0c06.js gzip 887 B 887 B
index-8081ce..e44f.js gzip 227 B 227 B
link-0ab9f83..fa00.js gzip 1.61 kB 1.61 kB
routerDirect..c3d8.js gzip 303 B 303 B
withRouter-0..a68e.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 614 B 613 B -1 B
link.html gzip 619 B 619 B
withRouter.html gzip 607 B 607 B
Overall change 1.84 kB 1.84 kB -1 B

Diffs

Diff for 677f882d2ed8..413dc7645.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1505,7 +1510,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1529,6 +1535,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1744,6 +1751,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _this$locales,
                     parsedAs,
                     localePathResult,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1794,7 +1803,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 19;
                               break;
                             }
 
@@ -1851,6 +1860,47 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                           case 14:
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
+                              this.locale
+                            ); // if we are navigating to a domain locale ensure we redirect to the
+                            // correct domain
+
+                            if (
+                              !(
+                                detectedDomain &&
+                                self.location.hostname !== detectedDomain.domain
+                              )
+                            ) {
+                              _context.next = 19;
+                              break;
+                            }
+
+                            asNoBasePath = delBasePath(as);
+                            window.location.href = "http"
+                              .concat(detectedDomain.http ? "" : "s", "://")
+                              .concat(detectedDomain.domain)
+                              .concat(
+                                addBasePath(
+                                  ""
+                                    .concat(
+                                      this.locale ===
+                                        detectedDomain.defaultLocale
+                                        ? ""
+                                        : "/".concat(this.locale)
+                                    )
+                                    .concat(
+                                      asNoBasePath === "/" ? "" : asNoBasePath
+                                    ) || "/"
+                                )
+                              );
+                            return _context.abrupt(
+                              "return",
+                              new Promise(function() {})
+                            );
+
+                          case 19:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1895,7 +1945,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 35;
                               break;
                             }
 
@@ -1916,7 +1966,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 35:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1926,30 +1976,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 37;
+                            _context.next = 40;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 40:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 43;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 43:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 51;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 47:
+                            _context.prev = 47;
+                            _context.t0 = _context["catch"](37);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 51:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1991,7 +2041,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 74;
                               break;
                             }
 
@@ -2014,7 +2064,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 73;
                               break;
                             }
 
@@ -2025,7 +2075,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2056,11 +2106,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 71:
+                            _context.next = 74;
                             break;
 
-                          case 68:
+                          case 73:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2076,14 +2126,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 74:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 75;
+                            _context.next = 78;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2092,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 78:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2107,7 +2157,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 90;
                               break;
                             }
 
@@ -2116,7 +2166,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 83;
+                              _context.next = 88;
                               break;
                             }
 
@@ -2126,7 +2176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 83;
+                              _context.next = 88;
                               break;
                             }
 
@@ -2142,14 +2192,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 88:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 90:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2160,7 +2210,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 95;
                             return this.set(
                               route,
                               pathname,
@@ -2172,9 +2222,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 95:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 98;
                               break;
                             }
 
@@ -2186,7 +2236,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 98:
                             if (false) {
                             }
 
@@ -2200,21 +2250,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 104:
+                            _context.prev = 104;
+                            _context.t1 = _context["catch"](75);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 108;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 108:
                             throw _context.t1;
 
-                          case 104:
+                          case 109:
                           case "end":
                             return _context.stop();
                         }
@@ -2223,8 +2273,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 99]
+                      [37, 47],
+                      [75, 104]
                     ]
                   );
                 })
Diff for main-0bc58ce..f930fc47a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -716,7 +717,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.98cd454f84e413dc7645.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f244ee195684d844ad1.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 12.7s 12.6s -134ms
nodeModulesSize 82.7 MB 82.7 MB ⚠️ +4.4 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..68d0.js gzip 12.7 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-8d1eb02..37d1.js gzip 6.56 kB N/A N/A
webpack-95c2..e870.js gzip 751 B 751 B
677f882d2ed8..4ea6.js gzip N/A 12.8 kB N/A
main-8448bb4..a494.js gzip N/A 6.57 kB N/A
Overall change 59 kB 59.1 kB ⚠️ +128 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-d3..23f6.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-0d19cb6..5497.js gzip 1.28 kB 1.28 kB
_error-85785..a9f3.js gzip 3.44 kB 3.44 kB
hooks-42456f..0c06.js gzip 887 B 887 B
index-8081ce..e44f.js gzip 227 B 227 B
link-0ab9f83..fa00.js gzip 1.61 kB 1.61 kB
routerDirect..c3d8.js gzip 303 B 303 B
withRouter-0..a68e.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.16 MB ⚠️ +641 B
Commit: 797586d

@vercel vercel bot temporarily deployed to Preview December 29, 2020 20:30 Inactive
@vercel vercel bot temporarily deployed to Preview December 29, 2020 20:56 Inactive
@vercel vercel bot temporarily deployed to Preview December 29, 2020 21:04 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 29, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 10.8s 10.7s -146ms
nodeModulesSize 82.9 MB 82.9 MB ⚠️ +5.28 kB
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 2.087 2.076 -0.01
/ avg req/sec 1197.95 1204.18 +6.23
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.397 1.313 -0.08
/error-in-render avg req/sec 1789.15 1903.5 +114.35
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..45a8.js gzip 12.7 kB 12.7 kB ⚠️ +30 B
framework.HASH.js gzip 39 kB 39 kB
main-eda9847..6ba4.js gzip 6.56 kB 6.57 kB ⚠️ +13 B
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59 kB 59.1 kB ⚠️ +43 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-370a053..c381.js gzip 1.28 kB 1.28 kB
_error-b7502..6249.js gzip 3.44 kB 3.44 kB
hooks-baa922..722d.js gzip 887 B 887 B
index-c8a663..7961.js gzip 227 B 227 B
link-64502f2..a071.js gzip 1.61 kB 1.61 kB
routerDirect..4623.js gzip 303 B 303 B
withRouter-f..7105.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 614 B 613 B -1 B
link.html gzip 620 B 620 B
withRouter.html gzip 608 B 608 B
Overall change 1.84 kB 1.84 kB -1 B

Diffs

Diff for 677f882d2ed8..7250b8f61.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1505,7 +1510,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1529,6 +1535,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1741,9 +1748,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   var _this2 = this;
 
                   var localeChange,
-                    _this$locales,
                     parsedAs,
                     localePathResult,
+                    _this$locales,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1794,7 +1803,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 21;
                               break;
                             }
 
@@ -1828,13 +1837,19 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                   this.locales
                                 ).pathname
                               );
-                            } // if the locale isn't configured hard navigate to show 404 page
+                            } // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (true) {
+                              _context.next = 15;
+                              break;
+                            }
 
                             if (
                               (_this$locales = this.locales) != null &&
                               _this$locales.includes(this.locale)
                             ) {
-                              _context.next = 14;
+                              _context.next = 15;
                               break;
                             }
 
@@ -1849,7 +1864,53 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               new Promise(function() {})
                             );
 
-                          case 14:
+                          case 15:
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
+                              this.locale
+                            ); // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (true) {
+                              _context.next = 21;
+                              break;
+                            }
+
+                            if (
+                              !(
+                                detectedDomain &&
+                                self.location.hostname !== detectedDomain.domain
+                              )
+                            ) {
+                              _context.next = 21;
+                              break;
+                            }
+
+                            asNoBasePath = delBasePath(as);
+                            window.location.href = "http"
+                              .concat(detectedDomain.http ? "" : "s", "://")
+                              .concat(detectedDomain.domain)
+                              .concat(
+                                addBasePath(
+                                  ""
+                                    .concat(
+                                      this.locale ===
+                                        detectedDomain.defaultLocale
+                                        ? ""
+                                        : "/".concat(this.locale)
+                                    )
+                                    .concat(
+                                      asNoBasePath === "/" ? "" : asNoBasePath
+                                    ) || "/"
+                                )
+                              );
+                            return _context.abrupt(
+                              "return",
+                              new Promise(function() {})
+                            );
+
+                          case 21:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1894,7 +1955,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 37;
                               break;
                             }
 
@@ -1915,7 +1976,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 37:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1925,30 +1986,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 39;
+                            _context.next = 42;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 42:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 45;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 45:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 53;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 49:
+                            _context.prev = 49;
+                            _context.t0 = _context["catch"](39);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 53:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1990,7 +2051,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 76;
                               break;
                             }
 
@@ -2013,7 +2074,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 75;
                               break;
                             }
 
@@ -2024,7 +2085,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 73;
                               break;
                             }
 
@@ -2055,11 +2116,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 73:
+                            _context.next = 76;
                             break;
 
-                          case 68:
+                          case 75:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2075,14 +2136,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 76:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 77;
+                            _context.next = 80;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2091,7 +2152,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 80:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2106,7 +2167,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 92;
                               break;
                             }
 
@@ -2115,7 +2176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 83;
+                              _context.next = 90;
                               break;
                             }
 
@@ -2125,7 +2186,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 83;
+                              _context.next = 90;
                               break;
                             }
 
@@ -2141,14 +2202,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 90:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 92:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2159,7 +2220,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 97;
                             return this.set(
                               route,
                               pathname,
@@ -2171,9 +2232,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 97:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 100;
                               break;
                             }
 
@@ -2185,7 +2246,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 100:
                             if (false) {
                             }
 
@@ -2199,21 +2260,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 106:
+                            _context.prev = 106;
+                            _context.t1 = _context["catch"](77);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 110;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 110:
                             throw _context.t1;
 
-                          case 104:
+                          case 111:
                           case "end":
                             return _context.stop();
                         }
@@ -2222,8 +2283,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 99]
+                      [39, 49],
+                      [77, 106]
                     ]
                   );
                 })
Diff for main-0bc58ce..f930fc47a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -716,7 +717,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.cf3ec0c188e536dae896.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.cf3ec0c188e536dae896.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.cf3ec0c188e536dae896.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.cf3ec0c188e536dae896.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.cf3ec0c188e536dae896.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.cf3ec0c188e536dae896.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 12.6s 12.4s -159ms
nodeModulesSize 82.9 MB 82.9 MB ⚠️ +5.28 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..45a8.js gzip 12.7 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-eda9847..6ba4.js gzip 6.56 kB N/A N/A
webpack-7193..1446.js gzip 751 B 751 B
677f882d2ed8..0532.js gzip N/A 12.7 kB N/A
main-c04bb98..cfcd.js gzip N/A 6.57 kB N/A
Overall change 59 kB 59.1 kB ⚠️ +43 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-370a053..c381.js gzip 1.28 kB 1.28 kB
_error-b7502..6249.js gzip 3.44 kB 3.44 kB
hooks-baa922..722d.js gzip 887 B 887 B
index-c8a663..7961.js gzip 227 B 227 B
link-64502f2..a071.js gzip 1.61 kB 1.61 kB
routerDirect..4623.js gzip 303 B 303 B
withRouter-f..7105.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.16 MB ⚠️ +641 B
Commit: be9c4ca

@vercel vercel bot temporarily deployed to Preview December 30, 2020 04:03 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 11s 10.8s -232ms
nodeModulesSize 83 MB 83 MB ⚠️ +5.47 kB
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 2.277 2.258 -0.02
/ avg req/sec 1097.94 1107.29 +9.35
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.618 1.588 -0.03
/error-in-render avg req/sec 1545 1574.22 +29.22
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..45a8.js gzip 12.7 kB 12.7 kB ⚠️ +26 B
framework.HASH.js gzip 39 kB 39 kB
main-eda9847..6ba4.js gzip 6.56 kB 6.57 kB ⚠️ +13 B
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59 kB 59 kB ⚠️ +39 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-634b837..baee.js gzip 1.61 kB 1.61 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 616 B 616 B
link.html gzip 621 B 622 B ⚠️ +1 B
withRouter.html gzip 608 B 608 B
Overall change 1.84 kB 1.85 kB ⚠️ +1 B

Diffs

Diff for 677f882d2ed8..7250b8f61.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1505,7 +1510,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1529,6 +1535,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1741,9 +1748,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   var _this2 = this;
 
                   var localeChange,
-                    _this$locales,
                     parsedAs,
                     localePathResult,
+                    didNavigate,
+                    _this$locales,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1794,7 +1804,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 16;
                               break;
                             }
 
@@ -1828,28 +1838,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                   this.locales
                                 ).pathname
                               );
-                            } // if the locale isn't configured hard navigate to show 404 page
+                            }
 
-                            if (
-                              (_this$locales = this.locales) != null &&
-                              _this$locales.includes(this.locale)
-                            ) {
-                              _context.next = 14;
-                              break;
+                            didNavigate = false; // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
                             }
 
-                            parsedAs.pathname = addLocale(
-                              parsedAs.pathname,
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
                               this.locale
-                            );
-                            window.location.href = (0,
-                            _utils.formatWithValidation)(parsedAs);
+                            ); // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
+                            }
+
+                            if (!didNavigate) {
+                              _context.next = 16;
+                              break;
+                            }
+
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 14:
+                          case 16:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1894,7 +1911,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 32;
                               break;
                             }
 
@@ -1915,7 +1932,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 32:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1925,30 +1942,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 34;
+                            _context.next = 37;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 37:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 40;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 40:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 48;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 44:
+                            _context.prev = 44;
+                            _context.t0 = _context["catch"](34);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 48:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1990,7 +2007,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2013,7 +2030,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 70;
                               break;
                             }
 
@@ -2024,7 +2041,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 68;
                               break;
                             }
 
@@ -2055,11 +2072,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 68:
+                            _context.next = 71;
                             break;
 
-                          case 68:
+                          case 70:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2075,14 +2092,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 71:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 72;
+                            _context.next = 75;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2091,7 +2108,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 75:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2106,7 +2123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 87;
                               break;
                             }
 
@@ -2115,7 +2132,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 83;
+                              _context.next = 85;
                               break;
                             }
 
@@ -2125,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 83;
+                              _context.next = 85;
                               break;
                             }
 
@@ -2141,14 +2158,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 85:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 87:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2159,7 +2176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 92;
                             return this.set(
                               route,
                               pathname,
@@ -2171,9 +2188,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 92:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 95;
                               break;
                             }
 
@@ -2185,7 +2202,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 95:
                             if (false) {
                             }
 
@@ -2199,21 +2216,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 101:
+                            _context.prev = 101;
+                            _context.t1 = _context["catch"](72);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 105;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 105:
                             throw _context.t1;
 
-                          case 104:
+                          case 106:
                           case "end":
                             return _context.stop();
                         }
@@ -2222,8 +2239,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 99]
+                      [34, 44],
+                      [72, 101]
                     ]
                   );
                 })
Diff for main-0bc58ce..f930fc47a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -716,7 +717,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ebf77c2131b3ff8619ca.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ebf77c2131b3ff8619ca.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ebf77c2131b3ff8619ca.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ebf77c2131b3ff8619ca.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      href="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ebf77c2131b3ff8619ca.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0bc58ce23e7f930fc47a.js"
+      src="/_next/static/chunks/main-0a2ce0f9d4ff068f22a7.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1aec164edf17250b8f61.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ebf77c2131b3ff8619ca.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 13.1s 12.9s -184ms
nodeModulesSize 83 MB 83 MB ⚠️ +5.47 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..45a8.js gzip 12.7 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-eda9847..6ba4.js gzip 6.56 kB N/A N/A
webpack-7193..1446.js gzip 751 B 751 B
677f882d2ed8..bbac.js gzip N/A 12.7 kB N/A
main-c04bb98..cfcd.js gzip N/A 6.57 kB N/A
Overall change 59 kB 59 kB ⚠️ +39 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-634b837..baee.js gzip 1.61 kB 1.61 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.16 MB ⚠️ +641 B
Commit: 4157ea7

@vercel vercel bot temporarily deployed to Preview December 30, 2020 04:40 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 10.1s 10.3s ⚠️ +160ms
nodeModulesSize 83 MB 83 MB ⚠️ +5.47 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 2.011 2.019 ⚠️ +0.01
/ avg req/sec 1243.34 1238.2 ⚠️ -5.14
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.276 1.302 ⚠️ +0.03
/error-in-render avg req/sec 1958.95 1920.47 ⚠️ -38.48
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..a1a8.js gzip 12.7 kB 12.8 kB ⚠️ +26 B
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB 6.59 kB ⚠️ +15 B
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59 kB 59.1 kB ⚠️ +41 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 615 B 614 B -1 B
link.html gzip 622 B 621 B -1 B
withRouter.html gzip 609 B 609 B
Overall change 1.85 kB 1.84 kB -2 B

Diffs

Diff for 677f882d2ed8..c824c380a.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1505,7 +1510,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1529,6 +1535,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1741,9 +1748,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   var _this2 = this;
 
                   var localeChange,
-                    _this$locales,
                     parsedAs,
                     localePathResult,
+                    didNavigate,
+                    _this$locales,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1794,7 +1804,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 16;
                               break;
                             }
 
@@ -1828,28 +1838,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                   this.locales
                                 ).pathname
                               );
-                            } // if the locale isn't configured hard navigate to show 404 page
+                            }
 
-                            if (
-                              (_this$locales = this.locales) != null &&
-                              _this$locales.includes(this.locale)
-                            ) {
-                              _context.next = 14;
-                              break;
+                            didNavigate = false; // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
                             }
 
-                            parsedAs.pathname = addLocale(
-                              parsedAs.pathname,
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
                               this.locale
-                            );
-                            window.location.href = (0,
-                            _utils.formatWithValidation)(parsedAs);
+                            ); // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
+                            }
+
+                            if (!didNavigate) {
+                              _context.next = 16;
+                              break;
+                            }
+
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 14:
+                          case 16:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1894,7 +1911,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 32;
                               break;
                             }
 
@@ -1915,7 +1932,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 32:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1925,30 +1942,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 34;
+                            _context.next = 37;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 37:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 40;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 40:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 48;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 44:
+                            _context.prev = 44;
+                            _context.t0 = _context["catch"](34);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 48:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1990,7 +2007,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2013,7 +2030,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 70;
                               break;
                             }
 
@@ -2024,7 +2041,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 68;
                               break;
                             }
 
@@ -2055,11 +2072,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 68:
+                            _context.next = 71;
                             break;
 
-                          case 68:
+                          case 70:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2075,14 +2092,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 71:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 72;
+                            _context.next = 75;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2091,7 +2108,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 75:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2106,7 +2123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 87;
                               break;
                             }
 
@@ -2115,7 +2132,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 83;
+                              _context.next = 85;
                               break;
                             }
 
@@ -2125,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 83;
+                              _context.next = 85;
                               break;
                             }
 
@@ -2141,14 +2158,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 85:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 87:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2159,7 +2176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 92;
                             return this.set(
                               route,
                               pathname,
@@ -2172,9 +2189,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 92:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 95;
                               break;
                             }
 
@@ -2186,7 +2203,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 95:
                             if (false) {
                             }
 
@@ -2200,21 +2217,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 101:
+                            _context.prev = 101;
+                            _context.t1 = _context["catch"](72);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 105;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 105:
                             throw _context.t1;
 
-                          case 104:
+                          case 106:
                           case "end":
                             return _context.stop();
                         }
@@ -2223,8 +2240,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 99]
+                      [34, 44],
+                      [72, 101]
                     ]
                   );
                 })
Diff for main-5fc9533..a71d69a9a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -721,7 +722,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2f5d359cbd5e142d2481.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2f5d359cbd5e142d2481.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2f5d359cbd5e142d2481.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2f5d359cbd5e142d2481.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2f5d359cbd5e142d2481.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2f5d359cbd5e142d2481.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 12.1s 12.3s ⚠️ +132ms
nodeModulesSize 83 MB 83 MB ⚠️ +5.47 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..a1a8.js gzip 12.7 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB N/A N/A
webpack-7193..1446.js gzip 751 B 751 B
677f882d2ed8..e60a.js gzip N/A 12.8 kB N/A
main-29e0222..8425.js gzip N/A 6.59 kB N/A
Overall change 59 kB 59.1 kB ⚠️ +41 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.17 MB ⚠️ +641 B
Commit: 678492b

@vercel vercel bot temporarily deployed to Preview December 30, 2020 05:11 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 10.4s 10.4s ⚠️ +17ms
nodeModulesSize 83 MB 83 MB ⚠️ +6.06 kB
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 2.058 2.034 -0.02
/ avg req/sec 1214.75 1229.12 +14.37
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.287 1.292 ⚠️ +0.01
/error-in-render avg req/sec 1941.81 1934.92 ⚠️ -6.89
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..a1a8.js gzip 12.7 kB 12.8 kB ⚠️ +26 B
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB 6.59 kB ⚠️ +15 B
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59 kB 59.1 kB ⚠️ +41 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 615 B 615 B
link.html gzip 622 B 620 B -2 B
withRouter.html gzip 609 B 608 B -1 B
Overall change 1.85 kB 1.84 kB -3 B

Diffs

Diff for 677f882d2ed8..c824c380a.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1505,7 +1510,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1529,6 +1535,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1741,9 +1748,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   var _this2 = this;
 
                   var localeChange,
-                    _this$locales,
                     parsedAs,
                     localePathResult,
+                    didNavigate,
+                    _this$locales,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1794,7 +1804,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 16;
                               break;
                             }
 
@@ -1828,28 +1838,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                   this.locales
                                 ).pathname
                               );
-                            } // if the locale isn't configured hard navigate to show 404 page
+                            }
 
-                            if (
-                              (_this$locales = this.locales) != null &&
-                              _this$locales.includes(this.locale)
-                            ) {
-                              _context.next = 14;
-                              break;
+                            didNavigate = false; // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
                             }
 
-                            parsedAs.pathname = addLocale(
-                              parsedAs.pathname,
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
                               this.locale
-                            );
-                            window.location.href = (0,
-                            _utils.formatWithValidation)(parsedAs);
+                            ); // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
+                            }
+
+                            if (!didNavigate) {
+                              _context.next = 16;
+                              break;
+                            }
+
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 14:
+                          case 16:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1894,7 +1911,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 32;
                               break;
                             }
 
@@ -1915,7 +1932,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 32:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1925,30 +1942,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 34;
+                            _context.next = 37;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 37:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 40;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 40:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 48;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 44:
+                            _context.prev = 44;
+                            _context.t0 = _context["catch"](34);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 48:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1990,7 +2007,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2013,7 +2030,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 70;
                               break;
                             }
 
@@ -2024,7 +2041,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 68;
                               break;
                             }
 
@@ -2055,11 +2072,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 68:
+                            _context.next = 71;
                             break;
 
-                          case 68:
+                          case 70:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2075,14 +2092,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 71:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 72;
+                            _context.next = 75;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2091,7 +2108,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 75:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2106,7 +2123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 87;
                               break;
                             }
 
@@ -2115,7 +2132,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 83;
+                              _context.next = 85;
                               break;
                             }
 
@@ -2125,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 83;
+                              _context.next = 85;
                               break;
                             }
 
@@ -2141,14 +2158,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 85:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 87:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2159,7 +2176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 92;
                             return this.set(
                               route,
                               pathname,
@@ -2172,9 +2189,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 92:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 95;
                               break;
                             }
 
@@ -2186,7 +2203,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 95:
                             if (false) {
                             }
 
@@ -2200,21 +2217,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 101:
+                            _context.prev = 101;
+                            _context.t1 = _context["catch"](72);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 105;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 105:
                             throw _context.t1;
 
-                          case 104:
+                          case 106:
                           case "end":
                             return _context.stop();
                         }
@@ -2223,8 +2240,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 99]
+                      [34, 44],
+                      [72, 101]
                     ]
                   );
                 })
Diff for main-5fc9533..a71d69a9a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -721,7 +722,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.35ca911d728f40c3326b.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.35ca911d728f40c3326b.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.35ca911d728f40c3326b.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.35ca911d728f40c3326b.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.35ca911d728f40c3326b.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a1c7a4f6454c824c380a.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.35ca911d728f40c3326b.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 12.3s 12.6s ⚠️ +302ms
nodeModulesSize 83 MB 83 MB ⚠️ +6.06 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..a1a8.js gzip 12.7 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB N/A N/A
webpack-7193..1446.js gzip 751 B 751 B
677f882d2ed8..74e5.js gzip N/A 12.8 kB N/A
main-29e0222..8425.js gzip N/A 6.59 kB N/A
Overall change 59 kB 59.1 kB ⚠️ +41 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.17 MB ⚠️ +641 B
Commit: a2028ba

Timer
Timer previously approved these changes Dec 30, 2020
@vercel vercel bot temporarily deployed to Preview December 30, 2020 05:37 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 9.6s 9.4s -210ms
nodeModulesSize 83 MB 83 MB ⚠️ +6.06 kB
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 1.848 1.829 -0.02
/ avg req/sec 1352.69 1366.68 +13.99
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.174 1.138 -0.04
/error-in-render avg req/sec 2129.45 2197.68 +68.23
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..8a62.js gzip 12.8 kB 12.8 kB ⚠️ +8 B
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB 6.59 kB ⚠️ +15 B
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.1 kB 59.1 kB ⚠️ +23 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 616 B 615 B -1 B
link.html gzip 623 B 621 B -2 B
withRouter.html gzip 609 B 609 B
Overall change 1.85 kB 1.84 kB -3 B

Diffs

Diff for 677f882d2ed8..23562bcb7.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1512,7 +1517,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1536,6 +1542,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1748,9 +1755,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   var _this2 = this;
 
                   var localeChange,
-                    _this$locales,
                     parsedAs,
                     localePathResult,
+                    didNavigate,
+                    _this$locales,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1803,7 +1813,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 16;
                               break;
                             }
 
@@ -1837,28 +1847,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                   this.locales
                                 ).pathname
                               );
-                            } // if the locale isn't configured hard navigate to show 404 page
+                            }
 
-                            if (
-                              (_this$locales = this.locales) != null &&
-                              _this$locales.includes(this.locale)
-                            ) {
-                              _context.next = 14;
-                              break;
+                            didNavigate = false; // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
                             }
 
-                            parsedAs.pathname = addLocale(
-                              parsedAs.pathname,
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
                               this.locale
-                            );
-                            window.location.href = (0,
-                            _utils.formatWithValidation)(parsedAs);
+                            ); // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
+                            }
+
+                            if (!didNavigate) {
+                              _context.next = 16;
+                              break;
+                            }
+
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 14:
+                          case 16:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1903,7 +1920,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 32;
                               break;
                             }
 
@@ -1924,7 +1941,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 32:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1934,30 +1951,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 34;
+                            _context.next = 37;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 37:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 40;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 40:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 48;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 44:
+                            _context.prev = 44;
+                            _context.t0 = _context["catch"](34);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 48:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1999,7 +2016,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2022,7 +2039,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 70;
                               break;
                             }
 
@@ -2033,7 +2050,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 68;
                               break;
                             }
 
@@ -2064,11 +2081,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 68:
+                            _context.next = 71;
                             break;
 
-                          case 68:
+                          case 70:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2084,14 +2101,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 71:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 72;
+                            _context.next = 75;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2100,7 +2117,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 75:
                             routeInfo = _context.sent;
                             (_routeInfo = routeInfo),
                               (error = _routeInfo.error),
@@ -2109,14 +2126,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               (__N_SSP = _routeInfo.__N_SSP); // handle redirect on client-transition
 
                             if (!((__N_SSG || __N_SSP) && props)) {
-                              _context.next = 100;
+                              _context.next = 102;
                               break;
                             }
 
                             if (
                               !(props.pageProps && props.pageProps.__N_REDIRECT)
                             ) {
-                              _context.next = 86;
+                              _context.next = 88;
                               break;
                             }
 
@@ -2125,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 84;
+                              _context.next = 86;
                               break;
                             }
 
@@ -2135,7 +2152,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 84;
+                              _context.next = 86;
                               break;
                             }
 
@@ -2151,35 +2168,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 84:
+                          case 86:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 86:
+                          case 88:
                             if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
-                              _context.next = 100;
+                              _context.next = 102;
                               break;
                             }
 
-                            _context.prev = 87;
-                            _context.next = 90;
+                            _context.prev = 89;
+                            _context.next = 92;
                             return this.fetchComponent("/404");
 
-                          case 90:
+                          case 92:
                             notFoundRoute = "/404";
-                            _context.next = 96;
+                            _context.next = 98;
                             break;
 
-                          case 93:
-                            _context.prev = 93;
-                            _context.t1 = _context["catch"](87);
+                          case 95:
+                            _context.prev = 95;
+                            _context.t1 = _context["catch"](89);
                             notFoundRoute = "/_error";
 
-                          case 96:
-                            _context.next = 98;
+                          case 98:
+                            _context.next = 100;
                             return this.getRouteInfo(
                               notFoundRoute,
                               notFoundRoute,
@@ -2190,11 +2207,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               }
                             );
 
-                          case 98:
+                          case 100:
                             routeInfo = _context.sent;
                             console.log("using routeInfo", routeInfo);
 
-                          case 100:
+                          case 102:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2205,7 +2222,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 105;
+                            _context.next = 107;
                             return this.set(
                               route,
                               pathname,
@@ -2218,9 +2235,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 105:
+                          case 107:
                             if (!error) {
-                              _context.next = 108;
+                              _context.next = 110;
                               break;
                             }
 
@@ -2232,7 +2249,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 108:
+                          case 110:
                             if (false) {
                             }
 
@@ -2246,21 +2263,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 114:
-                            _context.prev = 114;
-                            _context.t2 = _context["catch"](70);
+                          case 116:
+                            _context.prev = 116;
+                            _context.t2 = _context["catch"](72);
 
                             if (!_context.t2.cancelled) {
-                              _context.next = 118;
+                              _context.next = 120;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 118:
+                          case 120:
                             throw _context.t2;
 
-                          case 119:
+                          case 121:
                           case "end":
                             return _context.stop();
                         }
@@ -2269,9 +2286,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 114],
-                      [87, 93]
+                      [34, 44],
+                      [72, 116],
+                      [89, 95]
                     ]
                   );
                 })
Diff for main-5fc9533..a71d69a9a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -721,7 +722,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 12s 11.3s -688ms
nodeModulesSize 83 MB 83 MB ⚠️ +6.06 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..8a62.js gzip 12.8 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB N/A N/A
webpack-7193..1446.js gzip 751 B 751 B
677f882d2ed8..0acf.js gzip N/A 12.8 kB N/A
main-29e0222..8425.js gzip N/A 6.59 kB N/A
Overall change 59.1 kB 59.1 kB ⚠️ +23 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.17 MB ⚠️ +641 B
Commit: b50f08a

@ijjk
Copy link
Member Author

ijjk commented Dec 30, 2020

Failing test suites

Commit: b50f08a

test/integration/build-output/test/index.test.js

  • Build Output > Basic Application Output > should not deviate from snapshot
Expand output

● Build Output › Basic Application Output › should not deviate from snapshot

expect(received).toBeLessThanOrEqual(expected)

Expected: <= 0
Received:    0.10000000000000142

   96 | 
   97 |       // should be no bigger than 61.8 kb
>  98 |       expect(parseFloat(indexFirstLoad) - 62).toBeLessThanOrEqual(0)
      |                                               ^
   99 |       expect(indexFirstLoad.endsWith('kB')).toBe(true)
  100 | 
  101 |       expect(parseFloat(err404Size) - 3.7).toBeLessThanOrEqual(0)

  at Object.<anonymous> (integration/build-output/test/index.test.js:98:47)

@vercel vercel bot temporarily deployed to Preview December 30, 2020 06:24 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 9.9s 10.5s ⚠️ +522ms
nodeModulesSize 83 MB 83 MB ⚠️ +6.06 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
/ failed reqs 0 0
/ total time (seconds) 1.996 1.976 -0.02
/ avg req/sec 1252.36 1265.24 +12.88
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.199 1.225 ⚠️ +0.03
/error-in-render avg req/sec 2084.43 2040.65 ⚠️ -43.78
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..8a62.js gzip 12.8 kB 12.8 kB ⚠️ +8 B
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB 6.59 kB ⚠️ +15 B
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.1 kB 59.1 kB ⚠️ +23 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
index.html gzip 616 B 615 B -1 B
link.html gzip 623 B 621 B -2 B
withRouter.html gzip 609 B 609 B
Overall change 1.85 kB 1.84 kB -3 B

Diffs

Diff for 677f882d2ed8..23562bcb7.js
@@ -1224,6 +1224,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       /* global __NEXT_DATA__ */
       // tslint:disable:no-console
 
+      var detectDomainLocale;
+
+      if (false) {
+      }
+
       var basePath = false || "";
 
       function buildCancellationError() {
@@ -1512,7 +1517,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             isFallback = _ref.isFallback,
             locale = _ref.locale,
             locales = _ref.locales,
-            defaultLocale = _ref.defaultLocale;
+            defaultLocale = _ref.defaultLocale,
+            domainLocales = _ref.domainLocales;
 
           _classCallCheck(this, Router);
 
@@ -1536,6 +1542,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           this.locale = void 0;
           this.locales = void 0;
           this.defaultLocale = void 0;
+          this.domainLocales = void 0;
 
           this.onPopState = function(e) {
             var state = e.state;
@@ -1748,9 +1755,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   var _this2 = this;
 
                   var localeChange,
-                    _this$locales,
                     parsedAs,
                     localePathResult,
+                    didNavigate,
+                    _this$locales,
+                    detectedDomain,
+                    asNoBasePath,
                     _options$shallow,
                     shallow,
                     routeProps,
@@ -1803,7 +1813,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 14;
+                              _context.next = 16;
                               break;
                             }
 
@@ -1837,28 +1847,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                   this.locales
                                 ).pathname
                               );
-                            } // if the locale isn't configured hard navigate to show 404 page
+                            }
 
-                            if (
-                              (_this$locales = this.locales) != null &&
-                              _this$locales.includes(this.locale)
-                            ) {
-                              _context.next = 14;
-                              break;
+                            didNavigate = false; // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
                             }
 
-                            parsedAs.pathname = addLocale(
-                              parsedAs.pathname,
+                            detectedDomain = detectDomainLocale(
+                              this.domainLocales,
+                              undefined,
                               this.locale
-                            );
-                            window.location.href = (0,
-                            _utils.formatWithValidation)(parsedAs);
+                            ); // we need to wrap this in the env check again since regenerator runtime
+                            // moves this on its own due to the return
+
+                            if (false) {
+                            }
+
+                            if (!didNavigate) {
+                              _context.next = 16;
+                              break;
+                            }
+
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 14:
+                          case 16:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1903,7 +1920,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 30;
+                              _context.next = 32;
                               break;
                             }
 
@@ -1924,7 +1941,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 30:
+                          case 32:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1934,30 +1951,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // get their query parameters to allow ensuring they can be parsed properly
                             // when rewritten to
 
-                            _context.prev = 32;
-                            _context.next = 35;
+                            _context.prev = 34;
+                            _context.next = 37;
                             return this.pageLoader.getPageList();
 
-                          case 35:
+                          case 37:
                             pages = _context.sent;
-                            _context.next = 38;
+                            _context.next = 40;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 38:
+                          case 40:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 46;
+                            _context.next = 48;
                             break;
 
-                          case 42:
-                            _context.prev = 42;
-                            _context.t0 = _context["catch"](32);
+                          case 44:
+                            _context.prev = 44;
+                            _context.t0 = _context["catch"](34);
                             // If we fail to resolve the page list or client-build manifest, we must
                             // do a server-side transition:
                             window.location.href = as;
                             return _context.abrupt("return", false);
 
-                          case 46:
+                          case 48:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1999,7 +2016,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
 
                             if (!(0, _isDynamic.isDynamicRoute)(route)) {
-                              _context.next = 69;
+                              _context.next = 71;
                               break;
                             }
 
@@ -2022,7 +2039,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 70;
                               break;
                             }
 
@@ -2033,7 +2050,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 68;
                               break;
                             }
 
@@ -2064,11 +2081,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 68:
+                            _context.next = 71;
                             break;
 
-                          case 68:
+                          case 70:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2084,14 +2101,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 71:
                             Router.events.emit(
                               "routeChangeStart",
                               as,
                               routeProps
                             );
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 72;
+                            _context.next = 75;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2100,7 +2117,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               routeProps
                             );
 
-                          case 73:
+                          case 75:
                             routeInfo = _context.sent;
                             (_routeInfo = routeInfo),
                               (error = _routeInfo.error),
@@ -2109,14 +2126,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               (__N_SSP = _routeInfo.__N_SSP); // handle redirect on client-transition
 
                             if (!((__N_SSG || __N_SSP) && props)) {
-                              _context.next = 100;
+                              _context.next = 102;
                               break;
                             }
 
                             if (
                               !(props.pageProps && props.pageProps.__N_REDIRECT)
                             ) {
-                              _context.next = 86;
+                              _context.next = 88;
                               break;
                             }
 
@@ -2125,7 +2142,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             // it's not
 
                             if (!destination.startsWith("/")) {
-                              _context.next = 84;
+                              _context.next = 86;
                               break;
                             }
 
@@ -2135,7 +2152,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             this._resolveHref(parsedHref, pages, false);
 
                             if (!pages.includes(parsedHref.pathname)) {
-                              _context.next = 84;
+                              _context.next = 86;
                               break;
                             }
 
@@ -2151,35 +2168,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 84:
+                          case 86:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 86:
+                          case 88:
                             if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
-                              _context.next = 100;
+                              _context.next = 102;
                               break;
                             }
 
-                            _context.prev = 87;
-                            _context.next = 90;
+                            _context.prev = 89;
+                            _context.next = 92;
                             return this.fetchComponent("/404");
 
-                          case 90:
+                          case 92:
                             notFoundRoute = "/404";
-                            _context.next = 96;
+                            _context.next = 98;
                             break;
 
-                          case 93:
-                            _context.prev = 93;
-                            _context.t1 = _context["catch"](87);
+                          case 95:
+                            _context.prev = 95;
+                            _context.t1 = _context["catch"](89);
                             notFoundRoute = "/_error";
 
-                          case 96:
-                            _context.next = 98;
+                          case 98:
+                            _context.next = 100;
                             return this.getRouteInfo(
                               notFoundRoute,
                               notFoundRoute,
@@ -2190,11 +2207,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               }
                             );
 
-                          case 98:
+                          case 100:
                             routeInfo = _context.sent;
                             console.log("using routeInfo", routeInfo);
 
-                          case 100:
+                          case 102:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -2205,7 +2222,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (false) {
                             }
 
-                            _context.next = 105;
+                            _context.next = 107;
                             return this.set(
                               route,
                               pathname,
@@ -2218,9 +2235,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 105:
+                          case 107:
                             if (!error) {
-                              _context.next = 108;
+                              _context.next = 110;
                               break;
                             }
 
@@ -2232,7 +2249,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 108:
+                          case 110:
                             if (false) {
                             }
 
@@ -2246,21 +2263,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             return _context.abrupt("return", true);
 
-                          case 114:
-                            _context.prev = 114;
-                            _context.t2 = _context["catch"](70);
+                          case 116:
+                            _context.prev = 116;
+                            _context.t2 = _context["catch"](72);
 
                             if (!_context.t2.cancelled) {
-                              _context.next = 118;
+                              _context.next = 120;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 118:
+                          case 120:
                             throw _context.t2;
 
-                          case 119:
+                          case 121:
                           case "end":
                             return _context.stop();
                         }
@@ -2269,9 +2286,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [32, 42],
-                      [70, 114],
-                      [87, 93]
+                      [34, 44],
+                      [72, 116],
+                      [89, 95]
                     ]
                   );
                 })
Diff for main-5fc9533..a71d69a9a.js
@@ -362,7 +362,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         runtimeConfig = data.runtimeConfig,
         dynamicIds = data.dynamicIds,
         isFallback = data.isFallback,
-        locales = data.locales;
+        locales = data.locales,
+        domainLocales = data.domainLocales;
       var locale = data.locale,
         defaultLocale = data.defaultLocale;
       var prefix = assetPrefix || ""; // With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
@@ -721,7 +722,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                           },
                           locale: locale,
                           locales: locales,
-                          defaultLocale: defaultLocale
+                          defaultLocale: defaultLocale,
+                          domainLocales: domainLocales
                         }
                       ); // call init-client middleware
Diff for index.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       as="script"
     />
     <link
@@ -58,7 +58,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -7,7 +7,7 @@
     <noscript data-n-css=""></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      href="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       as="script"
     />
     <link
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       as="script"
     />
     <link
@@ -53,7 +53,7 @@
       src="/_next/static/chunks/polyfills-ae47a1f95297af5f55f8.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-5fc9533853da71d69a9a.js"
+      src="/_next/static/chunks/main-d375a7bab09d3ab14b1a.js"
       async=""
     ></script>
     <script
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.31897dcc8e923562bcb7.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.59db017fa4fde18d87d3.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
buildDuration 11.9s 12.1s ⚠️ +278ms
nodeModulesSize 83 MB 83 MB ⚠️ +6.06 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
677f882d2ed8..8a62.js gzip 12.8 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-74ce868..6a18.js gzip 6.57 kB N/A N/A
webpack-7193..1446.js gzip 751 B 751 B
677f882d2ed8..0acf.js gzip N/A 12.8 kB N/A
main-29e0222..8425.js gzip N/A 6.59 kB N/A
Overall change 59.1 kB 59.1 kB ⚠️ +23 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/domain-redirect Change
_error.js 1 MB 1 MB ⚠️ +73 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +73 B
link.js 1.06 MB 1.06 MB ⚠️ +165 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +165 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +165 B
Overall change 5.16 MB 5.17 MB ⚠️ +641 B
Commit: 19f3f50

@javiercr
Copy link

Hey @ijjk, just a heads up, I've filled a bug related to this PR, in case you want to take a look to it.
#22011

Thank you! 🙌

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirecting to locale domain
3 participants