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 href resolvedAs is correct with locale #20080

Merged
merged 2 commits into from Dec 12, 2020

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Dec 11, 2020

This makes sure the locale doesn't cause the wrong href to be resolved, this also ensures route specificity is correct when loading dynamic routes in production mode.

Fixes: #19747

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

ijjk commented Dec 11, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
buildDuration 10s 9.9s -141ms
nodeModulesSize 82.5 MB 82.5 MB ⚠️ +14 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
/ failed reqs 0 0
/ total time (seconds) 2.447 2.422 -0.02
/ avg req/sec 1021.83 1032.1 +10.27
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.248 1.289 ⚠️ +0.04
/error-in-render avg req/sec 2003.23 1939.52 ⚠️ -63.71
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
677f882d2ed8..34b9.js gzip 12.8 kB 12.8 kB -4 B
framework.HASH.js gzip 39 kB 39 kB
main-3e8cb31..cddc.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 59 kB 59 kB -4 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-01375..90b6.js gzip 3.69 kB 3.69 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..fd29.js gzip 303 B 303 B
withRouter-b..76ae.js gzip 302 B 302 B
Overall change 8.31 kB 8.31 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
index.html gzip 614 B 613 B -1 B
link.html gzip 620 B 618 B -2 B
withRouter.html gzip 608 B 606 B -2 B
Overall change 1.84 kB 1.84 kB -5 B

Diffs

Diff for 677f882d2ed8..4f72a9a2e.js
@@ -1194,6 +1194,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
       var _denormalizePagePath = __webpack_require__("wkBG");
 
+      var _normalizeLocalePath = __webpack_require__("3wub");
+
       var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
 
       var _utils = __webpack_require__("g/15");
@@ -1735,8 +1737,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
                   var localeChange,
                     _this$locales,
-                    _require,
-                    normalizeLocalePath,
                     parsedAs,
                     localePathResult,
                     cleanedAs,
@@ -1788,7 +1788,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 15;
+                              _context.next = 14;
                               break;
                             }
 
@@ -1801,13 +1801,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               options.locale = this.locale;
                             }
 
-                            (_require = __webpack_require__("3wub")),
-                              (normalizeLocalePath =
-                                _require.normalizeLocalePath);
                             parsedAs = (0, _parseRelativeUrl.parseRelativeUrl)(
                               hasBasePath(as) ? delBasePath(as) : as
                             );
-                            localePathResult = normalizeLocalePath(
+                            localePathResult = (0,
+                            _normalizeLocalePath.normalizeLocalePath)(
                               parsedAs.pathname,
                               this.locales
                             );
@@ -1822,7 +1820,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 ? void 0
                                 : _this$locales.includes(this.locale)
                             ) {
-                              _context.next = 15;
+                              _context.next = 14;
                               break;
                             }
 
@@ -1837,7 +1835,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               new Promise(function() {})
                             );
 
-                          case 15:
+                          case 14:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1870,7 +1868,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 29;
+                              _context.next = 28;
                               break;
                             }
 
@@ -1883,7 +1881,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             Router.events.emit("hashChangeComplete", as);
                             return _context.abrupt("return", true);
 
-                          case 29:
+                          case 28:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1893,30 +1891,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 = 31;
-                            _context.next = 34;
+                            _context.prev = 30;
+                            _context.next = 33;
                             return this.pageLoader.getPageList();
 
-                          case 34:
+                          case 33:
                             pages = _context.sent;
-                            _context.next = 37;
+                            _context.next = 36;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 37:
+                          case 36:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 45;
+                            _context.next = 44;
                             break;
 
-                          case 41:
-                            _context.prev = 41;
-                            _context.t0 = _context["catch"](31);
+                          case 40:
+                            _context.prev = 40;
+                            _context.t0 = _context["catch"](30);
                             // 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 45:
+                          case 44:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1963,7 +1961,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 = 68;
                               break;
                             }
 
@@ -1986,7 +1984,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 67;
                               break;
                             }
 
@@ -1997,7 +1995,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 65;
                               break;
                             }
 
@@ -2028,11 +2026,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 65:
+                            _context.next = 68;
                             break;
 
-                          case 68:
+                          case 67:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2048,10 +2046,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 68:
                             Router.events.emit("routeChangeStart", as);
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 69;
+                            _context.next = 72;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2060,7 +2058,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               shallow
                             );
 
-                          case 73:
+                          case 72:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2075,7 +2073,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 84;
                               break;
                             }
 
@@ -2084,7 +2082,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 = 82;
                               break;
                             }
 
@@ -2094,7 +2092,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 = 82;
                               break;
                             }
 
@@ -2110,21 +2108,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 82:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 84:
                             Router.events.emit("beforeHistoryChange", as);
                             this.changeState(method, url, as, options);
 
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 89;
                             return this.set(
                               route,
                               pathname,
@@ -2136,9 +2134,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 89:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 92;
                               break;
                             }
 
@@ -2149,7 +2147,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 92:
                             if (false) {
                             }
 
@@ -2159,21 +2157,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             Router.events.emit("routeChangeComplete", as);
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 98:
+                            _context.prev = 98;
+                            _context.t1 = _context["catch"](69);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 102;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 102:
                             throw _context.t1;
 
-                          case 104:
+                          case 103:
                           case "end":
                             return _context.stop();
                         }
@@ -2182,8 +2180,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [31, 41],
-                      [70, 99]
+                      [30, 40],
+                      [69, 98]
                     ]
                   );
                 })
@@ -2438,7 +2436,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     Component,
                     __N_SSG,
                     __N_SSP,
-                    _require2,
+                    _require,
                     isValidElementType,
                     dataHref,
                     props,
@@ -2515,7 +2513,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               break;
                             }
 
-                            (_require2 = __webpack_require__(
+                            (_require = __webpack_require__(
                               !(function webpackMissingModule() {
                                 var e = new Error(
                                   "Cannot find module 'react-is'"
@@ -2525,7 +2523,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               })()
                             )),
                               (isValidElementType =
-                                _require2.isValidElementType);
+                                _require.isValidElementType);
 
                             if (isValidElementType(Component)) {
                               _context3.next = 19;
@@ -2749,7 +2747,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     parsed,
                     _parsed2,
                     pathname,
-                    normalizeLocalePath,
                     parsedAs,
                     localePathResult,
                     pages,
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
buildDuration 12.1s 11.9s -223ms
nodeModulesSize 82.5 MB 82.5 MB ⚠️ +14 B
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
677f882d2ed8..34b9.js gzip 12.8 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-3e8cb31..cddc.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
677f882d2ed8..c0a8.js gzip N/A 12.8 kB N/A
Overall change 59 kB 59 kB -4 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-01375..90b6.js gzip 3.69 kB 3.69 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..fd29.js gzip 303 B 303 B
withRouter-b..76ae.js gzip 302 B 302 B
Overall change 8.31 kB 8.31 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix 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/href-resolving-fix Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB ⚠️ +57 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +57 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +57 B
Overall change 5.16 MB 5.16 MB ⚠️ +171 B
Commit: f64cafb

@vercel vercel bot temporarily deployed to Preview December 12, 2020 13:46 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 12, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
buildDuration 8.3s 8.3s -27ms
nodeModulesSize 82.5 MB 82.5 MB ⚠️ +14 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
/ failed reqs 0 0
/ total time (seconds) 2.045 2.059 ⚠️ +0.01
/ avg req/sec 1222.39 1213.92 ⚠️ -8.47
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.1 1.096 0
/error-in-render avg req/sec 2273.7 2280.94 +7.24
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
677f882d2ed8..34b9.js gzip 12.8 kB 12.8 kB -4 B
framework.HASH.js gzip 39 kB 39 kB
main-3e8cb31..cddc.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 59 kB 59 kB -4 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-01375..90b6.js gzip 3.69 kB 3.69 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..fd29.js gzip 303 B 303 B
withRouter-b..76ae.js gzip 302 B 302 B
Overall change 8.31 kB 8.31 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
index.html gzip 614 B 613 B -1 B
link.html gzip 620 B 618 B -2 B
withRouter.html gzip 608 B 606 B -2 B
Overall change 1.84 kB 1.84 kB -5 B

Diffs

Diff for 677f882d2ed8..4f72a9a2e.js
@@ -1194,6 +1194,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
       var _denormalizePagePath = __webpack_require__("wkBG");
 
+      var _normalizeLocalePath = __webpack_require__("3wub");
+
       var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
 
       var _utils = __webpack_require__("g/15");
@@ -1735,8 +1737,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
                   var localeChange,
                     _this$locales,
-                    _require,
-                    normalizeLocalePath,
                     parsedAs,
                     localePathResult,
                     cleanedAs,
@@ -1788,7 +1788,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             localeChange = options.locale !== this.locale;
 
                             if (true) {
-                              _context.next = 15;
+                              _context.next = 14;
                               break;
                             }
 
@@ -1801,13 +1801,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               options.locale = this.locale;
                             }
 
-                            (_require = __webpack_require__("3wub")),
-                              (normalizeLocalePath =
-                                _require.normalizeLocalePath);
                             parsedAs = (0, _parseRelativeUrl.parseRelativeUrl)(
                               hasBasePath(as) ? delBasePath(as) : as
                             );
-                            localePathResult = normalizeLocalePath(
+                            localePathResult = (0,
+                            _normalizeLocalePath.normalizeLocalePath)(
                               parsedAs.pathname,
                               this.locales
                             );
@@ -1822,7 +1820,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 ? void 0
                                 : _this$locales.includes(this.locale)
                             ) {
-                              _context.next = 15;
+                              _context.next = 14;
                               break;
                             }
 
@@ -1837,7 +1835,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               new Promise(function() {})
                             );
 
-                          case 15:
+                          case 14:
                             if (!options._h) {
                               this.isSsr = false;
                             } // marking route changes as a navigation start entry
@@ -1870,7 +1868,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             if (
                               !(!options._h && this.onlyAHashChange(cleanedAs))
                             ) {
-                              _context.next = 29;
+                              _context.next = 28;
                               break;
                             }
 
@@ -1883,7 +1881,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             Router.events.emit("hashChangeComplete", as);
                             return _context.abrupt("return", true);
 
-                          case 29:
+                          case 28:
                             parsed = (0, _parseRelativeUrl.parseRelativeUrl)(
                               url
                             );
@@ -1893,30 +1891,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 = 31;
-                            _context.next = 34;
+                            _context.prev = 30;
+                            _context.next = 33;
                             return this.pageLoader.getPageList();
 
-                          case 34:
+                          case 33:
                             pages = _context.sent;
-                            _context.next = 37;
+                            _context.next = 36;
                             return (0, _routeLoader.getClientBuildManifest)();
 
-                          case 37:
+                          case 36:
                             _yield = _context.sent;
                             rewrites = _yield.__rewrites;
-                            _context.next = 45;
+                            _context.next = 44;
                             break;
 
-                          case 41:
-                            _context.prev = 41;
-                            _context.t0 = _context["catch"](31);
+                          case 40:
+                            _context.prev = 40;
+                            _context.t0 = _context["catch"](30);
                             // 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 45:
+                          case 44:
                             parsed = this._resolveHref(parsed, pages);
 
                             if (parsed.pathname !== pathname) {
@@ -1963,7 +1961,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 = 68;
                               break;
                             }
 
@@ -1986,7 +1984,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 (shouldInterpolate && !interpolatedAs.result)
                               )
                             ) {
-                              _context.next = 68;
+                              _context.next = 67;
                               break;
                             }
 
@@ -1997,7 +1995,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             });
 
                             if (!(missingParams.length > 0)) {
-                              _context.next = 66;
+                              _context.next = 65;
                               break;
                             }
 
@@ -2028,11 +2026,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                             );
 
-                          case 66:
-                            _context.next = 69;
+                          case 65:
+                            _context.next = 68;
                             break;
 
-                          case 68:
+                          case 67:
                             if (shouldInterpolate) {
                               as = (0, _utils.formatWithValidation)(
                                 Object.assign({}, _parsedAs, {
@@ -2048,10 +2046,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               Object.assign(query, routeMatch);
                             }
 
-                          case 69:
+                          case 68:
                             Router.events.emit("routeChangeStart", as);
-                            _context.prev = 70;
-                            _context.next = 73;
+                            _context.prev = 69;
+                            _context.next = 72;
                             return this.getRouteInfo(
                               route,
                               pathname,
@@ -2060,7 +2058,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               shallow
                             );
 
-                          case 73:
+                          case 72:
                             routeInfo = _context.sent;
                             (error = routeInfo.error),
                               (props = routeInfo.props),
@@ -2075,7 +2073,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 props.pageProps.__N_REDIRECT
                               )
                             ) {
-                              _context.next = 85;
+                              _context.next = 84;
                               break;
                             }
 
@@ -2084,7 +2082,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 = 82;
                               break;
                             }
 
@@ -2094,7 +2092,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 = 82;
                               break;
                             }
 
@@ -2110,21 +2108,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               this.change(method, newUrl, newAs, options)
                             );
 
-                          case 83:
+                          case 82:
                             window.location.href = destination;
                             return _context.abrupt(
                               "return",
                               new Promise(function() {})
                             );
 
-                          case 85:
+                          case 84:
                             Router.events.emit("beforeHistoryChange", as);
                             this.changeState(method, url, as, options);
 
                             if (false) {
                             }
 
-                            _context.next = 90;
+                            _context.next = 89;
                             return this.set(
                               route,
                               pathname,
@@ -2136,9 +2134,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               else throw e;
                             });
 
-                          case 90:
+                          case 89:
                             if (!error) {
-                              _context.next = 93;
+                              _context.next = 92;
                               break;
                             }
 
@@ -2149,7 +2147,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             );
                             throw error;
 
-                          case 93:
+                          case 92:
                             if (false) {
                             }
 
@@ -2159,21 +2157,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                             Router.events.emit("routeChangeComplete", as);
                             return _context.abrupt("return", true);
 
-                          case 99:
-                            _context.prev = 99;
-                            _context.t1 = _context["catch"](70);
+                          case 98:
+                            _context.prev = 98;
+                            _context.t1 = _context["catch"](69);
 
                             if (!_context.t1.cancelled) {
-                              _context.next = 103;
+                              _context.next = 102;
                               break;
                             }
 
                             return _context.abrupt("return", false);
 
-                          case 103:
+                          case 102:
                             throw _context.t1;
 
-                          case 104:
+                          case 103:
                           case "end":
                             return _context.stop();
                         }
@@ -2182,8 +2180,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     _callee,
                     this,
                     [
-                      [31, 41],
-                      [70, 99]
+                      [30, 40],
+                      [69, 98]
                     ]
                   );
                 })
@@ -2438,7 +2436,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     Component,
                     __N_SSG,
                     __N_SSP,
-                    _require2,
+                    _require,
                     isValidElementType,
                     dataHref,
                     props,
@@ -2515,7 +2513,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               break;
                             }
 
-                            (_require2 = __webpack_require__(
+                            (_require = __webpack_require__(
                               !(function webpackMissingModule() {
                                 var e = new Error(
                                   "Cannot find module 'react-is'"
@@ -2525,7 +2523,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               })()
                             )),
                               (isValidElementType =
-                                _require2.isValidElementType);
+                                _require.isValidElementType);
 
                             if (isValidElementType(Component)) {
                               _context3.next = 19;
@@ -2749,7 +2747,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     parsed,
                     _parsed2,
                     pathname,
-                    normalizeLocalePath,
                     parsedAs,
                     localePathResult,
                     pages,
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.ef24a8546d94f72a9a2e.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8a3430f440125338bf5f.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
buildDuration 9.9s 9.8s -86ms
nodeModulesSize 82.5 MB 82.5 MB ⚠️ +14 B
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
677f882d2ed8..34b9.js gzip 12.8 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-3e8cb31..cddc.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
677f882d2ed8..c0a8.js gzip N/A 12.8 kB N/A
Overall change 59 kB 59 kB -4 B
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-01375..90b6.js gzip 3.69 kB 3.69 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..fd29.js gzip 303 B 303 B
withRouter-b..76ae.js gzip 302 B 302 B
Overall change 8.31 kB 8.31 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js i18n/href-resolving-fix 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/href-resolving-fix Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB ⚠️ +57 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +57 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +57 B
Overall change 5.16 MB 5.16 MB ⚠️ +171 B
Commit: ce7591c

@kodiakhq kodiakhq bot merged commit 5b89b1b into vercel:canary Dec 12, 2020
@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.

When using locales, error happen by using URL parameters and dynamic routes
2 participants