-
Notifications
You must be signed in to change notification settings - Fork 27k
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 rewrites are resolved while prefetching #22442
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ijjk
requested review from
divmain,
lfades,
Timer and
timneutkens
as code owners
February 23, 2021 04:07
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 11.5s | 11.4s | -88ms |
nodeModulesSize | 42.6 MB | 42.6 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.215 | 2.122 | -0.09 |
/ avg req/sec | 1128.8 | 1178.05 | +49.25 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.545 | 1.47 | -0.07 |
/error-in-render avg req/sec | 1618.39 | 1700.87 | +82.48 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..854c.js gzip | 13.2 kB | 13.3 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 613 B | 613 B | ✓ |
link.html gzip | 620 B | 621 B | |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB |
Diffs
Diff for 677f882d2ed8..7143b2168.js
@@ -1492,6 +1492,41 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
};
}
+ function resolveDynamicRoute(parsedHref, pages) {
+ var applyBasePath =
+ arguments.length > 2 && arguments[2] !== undefined
+ ? arguments[2]
+ : true;
+ var pathname = parsedHref.pathname;
+ var cleanPathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(
+ (0, _denormalizePagePath.denormalizePagePath)(
+ applyBasePath ? delBasePath(pathname) : pathname
+ )
+ );
+
+ if (cleanPathname === "/404" || cleanPathname === "/_error") {
+ return parsedHref;
+ } // handle resolving href for dynamic routes
+
+ if (!pages.includes(cleanPathname)) {
+ // eslint-disable-next-line array-callback-return
+ pages.some(function(page) {
+ if (
+ (0, _isDynamic.isDynamicRoute)(page) &&
+ (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
+ ) {
+ parsedHref.pathname = applyBasePath ? addBasePath(page) : page;
+ return true;
+ }
+ });
+ }
+
+ parsedHref.pathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(parsedHref.pathname);
+ return parsedHref;
+ }
+
var manualScrollRestoration = false && false;
var SSG_DATA_NOT_FOUND = Symbol("SSG_DATA_NOT_FOUND");
@@ -1827,8 +1862,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
options,
forcedScroll
) {
- var _this2 = this;
-
var _options$scroll,
localeChange,
parsedAs,
@@ -2064,7 +2097,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 50:
- parsed = this._resolveHref(parsed, pages);
+ parsed = resolveDynamicRoute(parsed, pages);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
@@ -2263,8 +2296,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
parsedHref = (0,
_parseRelativeUrl.parseRelativeUrl)(destination);
-
- this._resolveHref(parsedHref, pages, false);
+ resolveDynamicRoute(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
_context.next = 93;
@@ -2620,7 +2652,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
resolvedAs,
routeProps
) {
- var _this3 = this;
+ var _this2 = this;
var existingRouteInfo,
cachedRouteInfo,
@@ -2740,10 +2772,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_context3.next = 21;
return this._getData(function() {
return __N_SSG
- ? _this3._getStaticData(dataHref)
+ ? _this2._getStaticData(dataHref)
: __N_SSP
- ? _this3._getServerData(dataHref)
- : _this3.getInitialProps(
+ ? _this2._getServerData(dataHref)
+ : _this2.getInitialProps(
Component, // we provide AppTree later so this needs to be `any`
{
pathname: pathname,
@@ -2880,47 +2912,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: function urlIsNew(asPath) {
return this.asPath !== asPath;
}
- },
- {
- key: "_resolveHref",
- value: function _resolveHref(parsedHref, pages) {
- var applyBasePath =
- arguments.length > 2 && arguments[2] !== undefined
- ? arguments[2]
- : true;
- var pathname = parsedHref.pathname;
- var cleanPathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- (0, _denormalizePagePath.denormalizePagePath)(
- applyBasePath ? delBasePath(pathname) : pathname
- )
- );
-
- if (cleanPathname === "/404" || cleanPathname === "/_error") {
- return parsedHref;
- } // handle resolving href for dynamic routes
-
- if (!pages.includes(cleanPathname)) {
- // eslint-disable-next-line array-callback-return
- pages.some(function(page) {
- if (
- (0, _isDynamic.isDynamicRoute)(page) &&
- (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
- ) {
- parsedHref.pathname = applyBasePath
- ? addBasePath(page)
- : page;
- return true;
- }
- });
- }
-
- parsedHref.pathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- parsedHref.pathname
- );
- return parsedHref;
- }
/**
* Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
@@ -2933,7 +2924,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: (function() {
var _prefetch = _asyncToGenerator(
/*#__PURE__*/ _regeneratorRuntime.mark(function _callee4(url) {
- var _this4 = this;
+ var _this3 = this;
var asPath,
options,
@@ -2944,6 +2935,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
localePathResult,
pages,
route,
+ resolvedAs,
+ rewrites,
+ _yield2,
+ rewritesResult,
_args4 = arguments;
return _regeneratorRuntime.wrap(
@@ -2972,37 +2967,82 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 7:
pages = _context4.sent;
- parsed = this._resolveHref(parsed, pages, false);
+ parsed = resolveDynamicRoute(parsed, pages, false);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
url = (0, _utils.formatWithValidation)(parsed);
- } // Prefetch is not supported in development mode because it would trigger on-demand-entries
-
- if (true) {
- _context4.next = 12;
- break;
}
- return _context4.abrupt("return");
-
- case 12:
route = (0,
_normalizeTrailingSlash.removePathTrailingSlash)(
pathname
);
+ resolvedAs = asPath;
+
+ if (true) {
+ _context4.next = 19;
+ break;
+ }
+
_context4.next = 15;
+ return (0, _routeLoader.getClientBuildManifest)();
+
+ case 15:
+ _yield2 = _context4.sent;
+ rewrites = _yield2.__rewrites;
+ rewritesResult = (0, _resolveRewrites["default"])(
+ addBasePath(
+ addLocale(delBasePath(asPath), this.locale)
+ ),
+ pages,
+ rewrites,
+ parsed.query,
+ function(p) {
+ return resolveDynamicRoute(
+ {
+ pathname: p
+ },
+ pages
+ ).pathname;
+ },
+ this.locales
+ );
+
+ if (
+ rewritesResult.matchedPage &&
+ rewritesResult.resolvedHref
+ ) {
+ // if this directly matches a page we need to update the href to
+ // allow the correct page chunk to be loaded
+ route = rewritesResult.resolvedHref;
+ pathname = rewritesResult.resolvedHref;
+ parsed.pathname = pathname;
+ url = (0, _utils.formatWithValidation)(parsed);
+ resolvedAs = rewritesResult.asPath;
+ }
+
+ case 19:
+ if (true) {
+ _context4.next = 21;
+ break;
+ }
+
+ return _context4.abrupt("return");
+
+ case 21:
+ _context4.next = 23;
return Promise.all([
this.pageLoader._isSsg(url).then(function(isSsg) {
return isSsg
- ? _this4._getStaticData(
- _this4.pageLoader.getDataHref(
+ ? _this3._getStaticData(
+ _this3.pageLoader.getDataHref(
url,
- asPath,
+ resolvedAs,
true,
typeof options.locale !== "undefined"
? options.locale
- : _this4.locale
+ : _this3.locale
)
)
: false;
@@ -3012,7 +3052,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
](route)
]);
- case 15:
+ case 23:
case "end":
return _context4.stop();
}
@@ -3099,7 +3139,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getData",
value: function _getData(fn) {
- var _this5 = this;
+ var _this4 = this;
var cancelled = false;
@@ -3109,8 +3149,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.clc = cancel;
return fn().then(function(data) {
- if (cancel === _this5.clc) {
- _this5.clc = null;
+ if (cancel === _this4.clc) {
+ _this4.clc = null;
}
if (cancelled) {
@@ -3126,7 +3166,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getStaticData",
value: function _getStaticData(dataHref) {
- var _this6 = this;
+ var _this5 = this;
var _URL = new URL(dataHref, window.location.href),
cacheKey = _URL.href;
@@ -3136,7 +3176,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
return fetchNextData(dataHref, this.isSsr).then(function(data) {
- _this6.sdc[cacheKey] = data;
+ _this5.sdc[cacheKey] = data;
return data;
});
}
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7a8444d5b037143b2168.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5561054c82a47bf740a9.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7a8444d5b037143b2168.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5561054c82a47bf740a9.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7a8444d5b037143b2168.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5561054c82a47bf740a9.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7a8444d5b037143b2168.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5561054c82a47bf740a9.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7a8444d5b037143b2168.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5561054c82a47bf740a9.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7a8444d5b037143b2168.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5561054c82a47bf740a9.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.4s | -153ms |
nodeModulesSize | 42.6 MB | 42.6 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..854c.js gzip | 13.2 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..3234.js gzip | N/A | 13.3 kB | N/A |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_error.js | 1.01 MB | 1.01 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
500.html | 2.65 kB | 2.65 kB | ✓ |
amp.amp.html | 10.4 kB | 10.4 kB | ✓ |
amp.html | 1.86 kB | 1.86 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1.01 MB | 1.01 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.06 MB | 1.06 MB | |
withRouter.js | 1.06 MB | 1.06 MB | |
Overall change | 5.21 MB | 5.21 MB |
Webpack 5 Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 13.7s | 13.4s | -234ms |
nodeModulesSize | 42.6 MB | 42.6 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.21 | 2.153 | -0.06 |
/ avg req/sec | 1131.01 | 1161.43 | +30.42 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.52 | 1.505 | -0.02 |
/error-in-render avg req/sec | 1644.27 | 1661.47 | +17.2 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
597-dc8125e2..ef24.js gzip | 13.1 kB | 13.2 kB | |
framework.HASH.js gzip | 39.3 kB | 39.3 kB | ✓ |
main-HASH.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-HASH.js gzip | 954 B | 954 B | ✓ |
Overall change | 60 kB | 60.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.1 kB | 31.1 kB | ✓ |
Overall change | 31.1 kB | 31.1 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-aedc815..1421.js gzip | 1.26 kB | 1.26 kB | ✓ |
_error-71ec2..1a96.js gzip | 3.38 kB | 3.38 kB | ✓ |
amp-33a09cb0..6745.js gzip | 536 B | 536 B | ✓ |
hooks-4e968a..f870.js gzip | 902 B | 902 B | ✓ |
index-5c6845..f75c.js gzip | 230 B | 230 B | ✓ |
link-99f0c6c..b84a.js gzip | 1.65 kB | 1.65 kB | ✓ |
routerDirect..bb56.js gzip | 306 B | 306 B | ✓ |
withRouter-7..2133.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.57 kB | 8.57 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 326 B | 326 B | ✓ |
Overall change | 326 B | 326 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 585 B | 585 B | ✓ |
link.html gzip | 591 B | 592 B | |
withRouter.html gzip | 579 B | 581 B | |
Overall change | 1.75 kB | 1.76 kB |
Diffs
Diff for 677f882d2ed8..a6351854c.js
@@ -719,74 +719,75 @@
0;
return !1;
}),
- (e.addLocale = b),
- (e.delLocale = _),
- (e.hasBasePath = P),
- (e.addBasePath = k),
- (e.delBasePath = S),
- (e.isLocalURL = E),
- (e.interpolateAs = R),
- (e.resolveHref = O),
+ (e.addLocale = _),
+ (e.delLocale = x),
+ (e.hasBasePath = k),
+ (e.addBasePath = S),
+ (e.delBasePath = E),
+ (e.isLocalURL = R),
+ (e.interpolateAs = L),
+ (e.resolveHref = C),
(e.default = void 0);
var c = r("X24+"),
s = r("Nh2W"),
l = r("wkBG"),
- f = (r("3wub"), g(r("dZ6Y"))),
+ f = (r("3wub"), w(r("dZ6Y"))),
h = r("g/15"),
p = r("/jkW"),
d = r("hS4m"),
v = r("3WeD"),
- y = (g(r("GXs3")), r("gguc")),
- m = r("YTqd");
- function g(t) {
+ y = w(r("GXs3")),
+ m = r("gguc"),
+ g = r("YTqd");
+ function w(t) {
return t && t.__esModule ? t : { default: t };
}
- function w() {
+ function b() {
return Object.assign(new Error("Route Cancelled"), { cancelled: !0 });
}
- function b(t, e, r) {
+ function _(t, e, r) {
return t;
}
- function _(t, e) {
+ function x(t, e) {
return t;
}
- function x(t) {
+ function P(t) {
var e = t.indexOf("?"),
r = t.indexOf("#");
return (e > -1 || r > -1) && (t = t.substring(0, e > -1 ? e : r)), t;
}
- function P(t) {
- return "" === (t = x(t)) || t.startsWith("/");
- }
function k(t) {
+ return "" === (t = P(t)) || t.startsWith("/");
+ }
+ function S(t) {
return (function(t, e) {
return e && t.startsWith("/")
? "/" === t
? (0, c.normalizePathTrailingSlash)(e)
- : "".concat(e).concat("/" === x(t) ? t.substring(1) : t)
+ : "".concat(e).concat("/" === P(t) ? t.substring(1) : t)
: t;
})(t, "");
}
- function S(t) {
+ function E(t) {
return (
(t = t.slice("".length)).startsWith("/") || (t = "/".concat(t)), t
);
}
- function E(t) {
+ function R(t) {
if (t.startsWith("/") || t.startsWith("#")) return !0;
try {
var e = (0, h.getLocationOrigin)(),
r = new URL(t, e);
- return r.origin === e && P(r.pathname);
+ return r.origin === e && k(r.pathname);
} catch (n) {
return !1;
}
}
- function R(t, e, r) {
+ function L(t, e, r) {
var n = "",
- o = (0, m.getRouteRegex)(t),
+ o = (0, g.getRouteRegex)(t),
a = o.groups,
- i = (e !== t ? (0, y.getRouteMatcher)(o)(e) : "") || r;
+ i = (e !== t ? (0, m.getRouteMatcher)(o)(e) : "") || r;
n = t;
var u = Object.keys(a);
return (
@@ -816,7 +817,7 @@
{ params: u, result: n }
);
}
- function L(t, e) {
+ function O(t, e) {
var r = {};
return (
Object.keys(t).forEach(function(n) {
@@ -825,24 +826,24 @@
r
);
}
- function O(t, e, r) {
+ function C(t, e, r) {
var n = new URL(t, "http://n"),
o = "string" === typeof e ? e : (0, h.formatWithValidation)(e);
- if (!E(o)) return r ? [o] : o;
+ if (!R(o)) return r ? [o] : o;
try {
var a = new URL(o, n);
a.pathname = (0, c.normalizePathTrailingSlash)(a.pathname);
var i = "";
if ((0, p.isDynamicRoute)(a.pathname) && a.searchParams && r) {
var u = (0, v.searchParamsToUrlQuery)(a.searchParams),
- s = R(a.pathname, a.pathname, u),
+ s = L(a.pathname, a.pathname, u),
l = s.result,
f = s.params;
l &&
(i = (0, h.formatWithValidation)({
pathname: l,
hash: a.hash,
- query: L(u, f)
+ query: O(u, f)
}));
}
var d =
@@ -852,31 +853,53 @@
return r ? [o] : o;
}
}
- function C(t) {
+ function I(t) {
var e = (0, h.getLocationOrigin)();
return t.startsWith(e) ? t.substring(e.length) : t;
}
- function I(t, e, r) {
- var n = O(t.pathname, e, !0),
+ function j(t, e, r) {
+ var n = C(t.pathname, e, !0),
o = u(n, 2),
a = o[0],
i = o[1],
c = (0, h.getLocationOrigin)(),
s = a.startsWith(c),
l = i && i.startsWith(c);
- (a = C(a)), (i = i ? C(i) : i);
- var f = s ? a : k(a),
- p = r ? C(O(t.pathname, r)) : i || a;
- return { url: f, as: l ? p : k(p) };
+ (a = I(a)), (i = i ? I(i) : i);
+ var f = s ? a : S(a),
+ p = r ? I(C(t.pathname, r)) : i || a;
+ return { url: f, as: l ? p : S(p) };
}
- var j = Symbol("SSG_DATA_NOT_FOUND");
function T(t, e) {
+ var r =
+ !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2],
+ n = t.pathname,
+ o = (0, c.removePathTrailingSlash)(
+ (0, l.denormalizePagePath)(r ? E(n) : n)
+ );
+ return (
+ "/404" === o ||
+ "/_error" === o ||
+ (e.includes(o) ||
+ e.some(function(e) {
+ if (
+ (0, p.isDynamicRoute)(e) &&
+ (0, g.getRouteRegex)(e).re.test(o)
+ )
+ return (t.pathname = r ? S(e) : e), !0;
+ }),
+ (t.pathname = (0, c.removePathTrailingSlash)(t.pathname))),
+ t
+ );
+ }
+ var A = Symbol("SSG_DATA_NOT_FOUND");
+ function D(t, e) {
return fetch(t, { credentials: "same-origin" }).then(function(r) {
if (!r.ok) {
- if (e > 1 && r.status >= 500) return T(t, e - 1);
+ if (e > 1 && r.status >= 500) return D(t, e - 1);
if (404 === r.status)
return r.json().then(function(t) {
- if (t.notFound) return { notFound: j };
+ if (t.notFound) return { notFound: A };
throw new Error("Failed to load static props");
});
throw new Error("Failed to load static props");
@@ -884,12 +907,12 @@
return r.json();
});
}
- function A(t, e) {
- return T(t, e ? 3 : 1).catch(function(t) {
+ function M(t, e) {
+ return D(t, e ? 3 : 1).catch(function(t) {
throw (e || (0, s.markAssetError)(t), t);
});
}
- var D = (function() {
+ var N = (function() {
function t(e, r, n, o) {
var i = this,
u = o.initialProps,
@@ -956,7 +979,7 @@
s = i.query;
i.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(c), query: s }),
+ (0, h.formatWithValidation)({ pathname: S(c), query: s }),
(0, h.getURL)()
);
}
@@ -995,7 +1018,7 @@
"//" !== n.substr(0, 2) &&
this.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(e), query: r }),
+ (0, h.formatWithValidation)({ pathname: S(e), query: r }),
(0, h.getURL)(),
{ locale: w }
),
@@ -1022,7 +1045,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {};
- var n = I(this, t, e);
+ var n = j(this, t, e);
return (
(t = n.url), (e = n.as), this.change("pushState", t, e, r)
);
@@ -1035,7 +1058,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {},
- n = I(this, t, e);
+ n = j(this, t, e);
return (
(t = n.url), (e = n.as), this.change("replaceState", t, e, r)
);
@@ -1049,13 +1072,12 @@
var l,
f,
v,
- g,
+ y,
w,
- x,
- O,
+ b,
+ P,
C,
- T,
- A,
+ I,
D,
M,
N,
@@ -1065,8 +1087,8 @@
F,
G,
B,
- H,
V,
+ H,
X,
z,
J,
@@ -1078,13 +1100,14 @@
tt,
et,
rt,
- nt;
+ nt,
+ ot;
return n.wrap(
function(e) {
for (;;)
switch ((e.prev = e.next)) {
case 0:
- if (E(o)) {
+ if (R(o)) {
e.next = 3;
break;
}
@@ -1103,20 +1126,20 @@
(i._h || (this.isSsr = !1),
h.ST && performance.mark("routeChange"),
(v = i.shallow),
- (g = { shallow: void 0 !== v && v }),
+ (y = { shallow: void 0 !== v && v }),
this._inFlightRoute &&
this.abortComponentLoad(
this._inFlightRoute,
- g
+ y
),
- (a = k(
- b(
- P(a) ? S(a) : a,
+ (a = S(
+ _(
+ k(a) ? E(a) : a,
i.locale,
this.defaultLocale
)
)),
- (w = _(P(a) ? S(a) : a, this.locale)),
+ (w = x(k(a) ? E(a) : a, this.locale)),
(this._inFlightRoute = a),
i._h || !this.onlyAHashChange(w))
) {
@@ -1125,30 +1148,30 @@
}
return (
(this.asPath = w),
- t.events.emit("hashChangeStart", a, g),
+ t.events.emit("hashChangeStart", a, y),
this.changeState(r, o, a, i),
this.scrollToHash(w),
this.notify(this.components[this.route], null),
- t.events.emit("hashChangeComplete", a, g),
+ t.events.emit("hashChangeComplete", a, y),
e.abrupt("return", !0)
);
case 34:
return (
- (x = (0, d.parseRelativeUrl)(o)),
- (C = (O = x).pathname),
- (T = O.query),
+ (b = (0, d.parseRelativeUrl)(o)),
+ (C = (P = b).pathname),
+ (I = P.query),
(e.prev = 36),
(e.next = 39),
this.pageLoader.getPageList()
);
case 39:
return (
- (A = e.sent),
+ (D = e.sent),
(e.next = 42),
(0, s.getClientBuildManifest)()
);
case 42:
- (D = e.sent), D.__rewrites, (e.next = 50);
+ (M = e.sent), M.__rewrites, (e.next = 50);
break;
case 46:
return (
@@ -1159,16 +1182,16 @@
);
case 50:
if (
- ((x = this._resolveHref(x, A)).pathname !== C &&
- ((C = x.pathname),
- (o = (0, h.formatWithValidation)(x))),
+ ((b = T(b, D)).pathname !== C &&
+ ((C = b.pathname),
+ (o = (0, h.formatWithValidation)(b))),
(C = C
- ? (0, c.removePathTrailingSlash)(S(C))
+ ? (0, c.removePathTrailingSlash)(E(C))
: C),
this.urlIsNew(w) || f || (r = "replaceState"),
- (M = (0, c.removePathTrailingSlash)(C)),
- (N = a),
- E(a))
+ (N = (0, c.removePathTrailingSlash)(C)),
+ (U = a),
+ R(a))
) {
e.next = 62;
break;
@@ -1182,29 +1205,29 @@
);
case 62:
if (
- ((N = _(S(N), this.locale)),
- !(0, p.isDynamicRoute)(M))
+ ((U = x(E(U), this.locale)),
+ !(0, p.isDynamicRoute)(N))
) {
e.next = 78;
break;
}
if (
- ((U = (0, d.parseRelativeUrl)(N)),
- (W = U.pathname),
- (q = (0, m.getRouteRegex)(M)),
- (F = (0, y.getRouteMatcher)(q)(W)),
- (B = (G = M === W) ? R(M, W, T) : {}),
- F && (!G || B.result))
+ ((W = (0, d.parseRelativeUrl)(U)),
+ (q = W.pathname),
+ (F = (0, g.getRouteRegex)(N)),
+ (G = (0, m.getRouteMatcher)(F)(q)),
+ (V = (B = N === q) ? L(N, q, I) : {}),
+ G && (!B || V.result))
) {
e.next = 77;
break;
}
if (
!(
- (H = Object.keys(q.groups).filter(function(
+ (H = Object.keys(F.groups).filter(function(
t
) {
- return !T[t];
+ return !I[t];
})).length > 0
)
) {
@@ -1212,7 +1235,7 @@
break;
}
throw new Error(
- (G
+ (B
? "The provided `href` ("
.concat(
o,
@@ -1224,12 +1247,12 @@
)
: "The provided `as` value ("
.concat(
- W,
+ q,
") is incompatible with the `href` value ("
)
- .concat(M, "). ")) +
+ .concat(N, "). ")) +
"Read more: https://err.sh/vercel/next.js/".concat(
- G
+ B
? "href-interpolation-failed"
: "incompatible-href-as"
)
@@ -1238,66 +1261,65 @@
e.next = 78;
break;
case 77:
- G
+ B
? (a = (0, h.formatWithValidation)(
- Object.assign({}, U, {
- pathname: B.result,
- query: L(T, B.params)
+ Object.assign({}, W, {
+ pathname: V.result,
+ query: O(I, V.params)
})
))
- : Object.assign(T, F);
+ : Object.assign(I, G);
case 78:
return (
- t.events.emit("routeChangeStart", a, g),
+ t.events.emit("routeChangeStart", a, y),
(e.prev = 79),
(e.next = 82),
- this.getRouteInfo(M, C, T, a, N, g)
+ this.getRouteInfo(N, C, I, a, U, y)
);
case 82:
if (
- ((V = e.sent),
- (z = (X = V).error),
- (J = X.props),
- ($ = X.__N_SSG),
- (Y = X.__N_SSP),
- (!$ && !Y) || !J)
+ ((X = e.sent),
+ (J = (z = X).error),
+ ($ = z.props),
+ (Y = z.__N_SSG),
+ (Q = z.__N_SSP),
+ (!Y && !Q) || !$)
) {
e.next = 109;
break;
}
- if (!J.pageProps || !J.pageProps.__N_REDIRECT) {
+ if (!$.pageProps || !$.pageProps.__N_REDIRECT) {
e.next = 95;
break;
}
if (
- !(Q = J.pageProps.__N_REDIRECT).startsWith("/")
+ !(Z = $.pageProps.__N_REDIRECT).startsWith("/")
) {
e.next = 93;
break;
}
if (
- ((Z = (0, d.parseRelativeUrl)(Q)),
- this._resolveHref(Z, A, !1),
- !A.includes(Z.pathname))
+ (T((K = (0, d.parseRelativeUrl)(Z)), D, !1),
+ !D.includes(K.pathname))
) {
e.next = 93;
break;
}
return (
- (K = I(this, Q, Q)),
- (tt = K.url),
- (et = K.as),
- e.abrupt("return", this.change(r, tt, et, i))
+ (tt = j(this, Z, Z)),
+ (et = tt.url),
+ (rt = tt.as),
+ e.abrupt("return", this.change(r, et, rt, i))
);
case 93:
return (
- (window.location.href = Q),
+ (window.location.href = Z),
e.abrupt("return", new Promise(function() {}))
);
case 95:
if (
- ((this.isPreview = !!J.__N_PREVIEW),
- J.notFound !== j)
+ ((this.isPreview = !!$.__N_PREVIEW),
+ $.notFound !== A)
) {
e.next = 109;
break;
@@ -1308,49 +1330,49 @@
this.fetchComponent("/404")
);
case 100:
- (rt = "/404"), (e.next = 106);
+ (nt = "/404"), (e.next = 106);
break;
case 103:
(e.prev = 103),
(e.t1 = e.catch(97)),
- (rt = "/_error");
+ (nt = "/_error");
case 106:
return (
(e.next = 108),
- this.getRouteInfo(rt, rt, T, a, N, {
+ this.getRouteInfo(nt, nt, I, a, U, {
shallow: !1
})
);
case 108:
- V = e.sent;
+ X = e.sent;
case 109:
return (
- t.events.emit("beforeHistoryChange", a, g),
+ t.events.emit("beforeHistoryChange", a, y),
this.changeState(r, o, a, i),
- (nt = i.shallow && this.route === M),
+ (ot = i.shallow && this.route === N),
(e.next = 115),
this.set(
- M,
+ N,
C,
- T,
+ I,
w,
- V,
- u || (nt || !i.scroll ? null : { x: 0, y: 0 })
+ X,
+ u || (ot || !i.scroll ? null : { x: 0, y: 0 })
).catch(function(t) {
if (!t.cancelled) throw t;
- z = z || t;
+ J = J || t;
})
);
case 115:
- if (!z) {
+ if (!J) {
e.next = 118;
break;
}
- throw (t.events.emit("routeChangeError", z, w, g),
- z);
+ throw (t.events.emit("routeChangeError", J, w, y),
+ J);
case 118:
return (
- t.events.emit("routeChangeComplete", a, g),
+ t.events.emit("routeChangeComplete", a, y),
e.abrupt("return", !0)
);
case 123:
@@ -1431,7 +1453,7 @@
}
throw (t.events.emit("routeChangeError", r, i, u),
(window.location.href = i),
- w());
+ b());
case 6:
if (
((e.prev = 6),
@@ -1684,32 +1706,6 @@
return this.asPath !== t;
}
},
- {
- key: "_resolveHref",
- value: function(t, e) {
- var r =
- !(arguments.length > 2 && void 0 !== arguments[2]) ||
- arguments[2],
- n = t.pathname,
- o = (0, c.removePathTrailingSlash)(
- (0, l.denormalizePagePath)(r ? S(n) : n)
- );
- return (
- "/404" === o ||
- "/_error" === o ||
- (e.includes(o) ||
- e.some(function(e) {
- if (
- (0, p.isDynamicRoute)(e) &&
- (0, m.getRouteRegex)(e).re.test(o)
- )
- return (t.pathname = r ? k(e) : e), !0;
- }),
- (t.pathname = (0, c.removePathTrailingSlash)(t.pathname))),
- t
- );
- }
- },
{
key: "prefetch",
value: (function() {
@@ -1721,8 +1717,12 @@
i,
u,
s,
- l = this,
- f = arguments;
+ l,
+ f,
+ p,
+ v,
+ m = this,
+ g = arguments;
return n.wrap(
function(t) {
for (;;)
@@ -1730,9 +1730,9 @@
case 0:
return (
(r =
- f.length > 1 && void 0 !== f[1] ? f[1] : e),
+ g.length > 1 && void 0 !== g[1] ? g[1] : e),
(o =
- f.length > 2 && void 0 !== f[2] ? f[2] : {}),
+ g.length > 2 && void 0 !== g[2] ? g[2] : {}),
(a = (0, d.parseRelativeUrl)(e)),
(i = a.pathname),
(t.next = 7),
@@ -1740,28 +1740,50 @@
);
case 7:
(u = t.sent),
- (a = this._resolveHref(a, u, !1)).pathname !==
- i &&
+ (a = T(a, u, !1)).pathname !== i &&
((i = a.pathname),
(e = (0, h.formatWithValidation)(a))),
- (t.next = 12);
+ (s = (0, c.removePathTrailingSlash)(i)),
+ (l = r),
+ (t.next = 19);
break;
- case 12:
+ case 15:
+ (p = t.sent),
+ (f = p.__rewrites),
+ (v = (0, y.default)(
+ S(_(E(r), this.locale)),
+ u,
+ f,
+ a.query,
+ function(t) {
+ return T({ pathname: t }, u).pathname;
+ },
+ this.locales
+ )).matchedPage &&
+ v.resolvedHref &&
+ ((s = v.resolvedHref),
+ (i = v.resolvedHref),
+ (a.pathname = i),
+ (e = (0, h.formatWithValidation)(a)),
+ (l = v.asPath));
+ case 19:
+ t.next = 21;
+ break;
+ case 21:
return (
- (s = (0, c.removePathTrailingSlash)(i)),
- (t.next = 15),
+ (t.next = 23),
Promise.all([
this.pageLoader._isSsg(e).then(function(t) {
return (
!!t &&
- l._getStaticData(
- l.pageLoader.getDataHref(
+ m._getStaticData(
+ m.pageLoader.getDataHref(
e,
- r,
+ l,
!0,
"undefined" !== typeof o.locale
? o.locale
- : l.locale
+ : m.locale
)
)
);
@@ -1771,7 +1793,7 @@
](s)
])
);
- case 15:
+ case 23:
case "end":
return t.stop();
}
@@ -1864,7 +1886,7 @@
r = new URL(t, window.location.href).href;
return !this.isPreview && this.sdc[r]
? Promise.resolve(this.sdc[r])
- : A(t, this.isSsr).then(function(t) {
+ : M(t, this.isSsr).then(function(t) {
return (e.sdc[r] = t), t;
});
}
@@ -1872,7 +1894,7 @@
{
key: "_getServerData",
value: function(t) {
- return A(t, this.isSsr);
+ return M(t, this.isSsr);
}
},
{
@@ -1895,7 +1917,7 @@
key: "abortComponentLoad",
value: function(e, r) {
this.clc &&
- (t.events.emit("routeChangeError", w(), e, r),
+ (t.events.emit("routeChangeError", b(), e, r),
this.clc(),
(this.clc = null));
}
@@ -1910,7 +1932,7 @@
t
);
})();
- (e.default = D), (D.events = (0, f.default)());
+ (e.default = N), (N.events = (0, f.default)());
},
"g/15": function(t, e, r) {
"use strict";
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.66488b33a5ba6351854c.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1b711457c93828da3234.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/",
"query": {},
- "buildId": "ErbssARo_v4Ra11ftrV50",
+ "buildId": "Ib3QOxmYWbDas8Z03zurO",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.66488b33a5ba6351854c.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1b711457c93828da3234.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/ErbssARo_v4Ra11ftrV50/_buildManifest.js"
+ src="/_next/static/Ib3QOxmYWbDas8Z03zurO/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/ErbssARo_v4Ra11ftrV50/_ssgManifest.js"
+ src="/_next/static/Ib3QOxmYWbDas8Z03zurO/_ssgManifest.js"
async=""
></script>
</body>
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.66488b33a5ba6351854c.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1b711457c93828da3234.js"
as="script"
/>
<link
@@ -48,7 +48,7 @@
"props": { "pageProps": {} },
"page": "/link",
"query": {},
- "buildId": "ErbssARo_v4Ra11ftrV50",
+ "buildId": "Ib3QOxmYWbDas8Z03zurO",
"isFallback": false,
"gip": true
}
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.66488b33a5ba6351854c.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1b711457c93828da3234.js"
async=""
></script>
<script
@@ -82,11 +82,11 @@
async=""
></script>
<script
- src="/_next/static/ErbssARo_v4Ra11ftrV50/_buildManifest.js"
+ src="/_next/static/Ib3QOxmYWbDas8Z03zurO/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/ErbssARo_v4Ra11ftrV50/_ssgManifest.js"
+ src="/_next/static/Ib3QOxmYWbDas8Z03zurO/_ssgManifest.js"
async=""
></script>
</body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.66488b33a5ba6351854c.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1b711457c93828da3234.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/withRouter",
"query": {},
- "buildId": "ErbssARo_v4Ra11ftrV50",
+ "buildId": "Ib3QOxmYWbDas8Z03zurO",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.66488b33a5ba6351854c.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1b711457c93828da3234.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/ErbssARo_v4Ra11ftrV50/_buildManifest.js"
+ src="/_next/static/Ib3QOxmYWbDas8Z03zurO/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/ErbssARo_v4Ra11ftrV50/_ssgManifest.js"
+ src="/_next/static/Ib3QOxmYWbDas8Z03zurO/_ssgManifest.js"
async=""
></script>
</body>
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 9.5s | 9.6s | |
nodeModulesSize | 42.7 MB | 42.7 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.811 | 1.796 | -0.01 |
/ avg req/sec | 1380.42 | 1392.35 | +11.93 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.09 | 1.098 | |
/error-in-render avg req/sec | 2293.03 | 2275.91 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..db13.js gzip | 13.3 kB | 13.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 614 B | 612 B | -2 B |
link.html gzip | 619 B | 619 B | ✓ |
withRouter.html gzip | 608 B | 607 B | -1 B |
Overall change | 1.84 kB | 1.84 kB | -3 B |
Diffs
Diff for 677f882d2ed8..2f1e56545.js
@@ -1492,6 +1492,41 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
};
}
+ function resolveDynamicRoute(parsedHref, pages) {
+ var applyBasePath =
+ arguments.length > 2 && arguments[2] !== undefined
+ ? arguments[2]
+ : true;
+ var pathname = parsedHref.pathname;
+ var cleanPathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(
+ (0, _denormalizePagePath.denormalizePagePath)(
+ applyBasePath ? delBasePath(pathname) : pathname
+ )
+ );
+
+ if (cleanPathname === "/404" || cleanPathname === "/_error") {
+ return parsedHref;
+ } // handle resolving href for dynamic routes
+
+ if (!pages.includes(cleanPathname)) {
+ // eslint-disable-next-line array-callback-return
+ pages.some(function(page) {
+ if (
+ (0, _isDynamic.isDynamicRoute)(page) &&
+ (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
+ ) {
+ parsedHref.pathname = applyBasePath ? addBasePath(page) : page;
+ return true;
+ }
+ });
+ }
+
+ parsedHref.pathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(parsedHref.pathname);
+ return parsedHref;
+ }
+
var manualScrollRestoration = false && false;
var SSG_DATA_NOT_FOUND = Symbol("SSG_DATA_NOT_FOUND");
@@ -1827,8 +1862,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
options,
forcedScroll
) {
- var _this2 = this;
-
var _options$scroll,
localeChange,
parsedAs,
@@ -2066,7 +2099,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 50:
- parsed = this._resolveHref(parsed, pages);
+ parsed = resolveDynamicRoute(parsed, pages);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
@@ -2265,8 +2298,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
parsedHref = (0,
_parseRelativeUrl.parseRelativeUrl)(destination);
-
- this._resolveHref(parsedHref, pages, false);
+ resolveDynamicRoute(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
_context.next = 93;
@@ -2641,7 +2673,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
resolvedAs,
routeProps
) {
- var _this3 = this;
+ var _this2 = this;
var existingRouteInfo,
cachedRouteInfo,
@@ -2761,10 +2793,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_context3.next = 21;
return this._getData(function() {
return __N_SSG
- ? _this3._getStaticData(dataHref)
+ ? _this2._getStaticData(dataHref)
: __N_SSP
- ? _this3._getServerData(dataHref)
- : _this3.getInitialProps(
+ ? _this2._getServerData(dataHref)
+ : _this2.getInitialProps(
Component, // we provide AppTree later so this needs to be `any`
{
pathname: pathname,
@@ -2901,47 +2933,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: function urlIsNew(asPath) {
return this.asPath !== asPath;
}
- },
- {
- key: "_resolveHref",
- value: function _resolveHref(parsedHref, pages) {
- var applyBasePath =
- arguments.length > 2 && arguments[2] !== undefined
- ? arguments[2]
- : true;
- var pathname = parsedHref.pathname;
- var cleanPathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- (0, _denormalizePagePath.denormalizePagePath)(
- applyBasePath ? delBasePath(pathname) : pathname
- )
- );
-
- if (cleanPathname === "/404" || cleanPathname === "/_error") {
- return parsedHref;
- } // handle resolving href for dynamic routes
-
- if (!pages.includes(cleanPathname)) {
- // eslint-disable-next-line array-callback-return
- pages.some(function(page) {
- if (
- (0, _isDynamic.isDynamicRoute)(page) &&
- (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
- ) {
- parsedHref.pathname = applyBasePath
- ? addBasePath(page)
- : page;
- return true;
- }
- });
- }
-
- parsedHref.pathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- parsedHref.pathname
- );
- return parsedHref;
- }
/**
* Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
@@ -2954,7 +2945,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: (function() {
var _prefetch = _asyncToGenerator(
/*#__PURE__*/ _regeneratorRuntime.mark(function _callee4(url) {
- var _this4 = this;
+ var _this3 = this;
var asPath,
options,
@@ -2965,6 +2956,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
localePathResult,
pages,
route,
+ resolvedAs,
+ rewrites,
+ _yield2,
+ rewritesResult,
_args4 = arguments;
return _regeneratorRuntime.wrap(
@@ -2993,37 +2988,82 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 7:
pages = _context4.sent;
- parsed = this._resolveHref(parsed, pages, false);
+ parsed = resolveDynamicRoute(parsed, pages, false);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
url = (0, _utils.formatWithValidation)(parsed);
- } // Prefetch is not supported in development mode because it would trigger on-demand-entries
-
- if (true) {
- _context4.next = 12;
- break;
}
- return _context4.abrupt("return");
-
- case 12:
route = (0,
_normalizeTrailingSlash.removePathTrailingSlash)(
pathname
);
+ resolvedAs = asPath;
+
+ if (true) {
+ _context4.next = 19;
+ break;
+ }
+
_context4.next = 15;
+ return (0, _routeLoader.getClientBuildManifest)();
+
+ case 15:
+ _yield2 = _context4.sent;
+ rewrites = _yield2.__rewrites;
+ rewritesResult = (0, _resolveRewrites["default"])(
+ addBasePath(
+ addLocale(delBasePath(asPath), this.locale)
+ ),
+ pages,
+ rewrites,
+ parsed.query,
+ function(p) {
+ return resolveDynamicRoute(
+ {
+ pathname: p
+ },
+ pages
+ ).pathname;
+ },
+ this.locales
+ );
+
+ if (
+ rewritesResult.matchedPage &&
+ rewritesResult.resolvedHref
+ ) {
+ // if this directly matches a page we need to update the href to
+ // allow the correct page chunk to be loaded
+ route = rewritesResult.resolvedHref;
+ pathname = rewritesResult.resolvedHref;
+ parsed.pathname = pathname;
+ url = (0, _utils.formatWithValidation)(parsed);
+ resolvedAs = rewritesResult.asPath;
+ }
+
+ case 19:
+ if (true) {
+ _context4.next = 21;
+ break;
+ }
+
+ return _context4.abrupt("return");
+
+ case 21:
+ _context4.next = 23;
return Promise.all([
this.pageLoader._isSsg(url).then(function(isSsg) {
return isSsg
- ? _this4._getStaticData(
- _this4.pageLoader.getDataHref(
+ ? _this3._getStaticData(
+ _this3.pageLoader.getDataHref(
url,
- asPath,
+ resolvedAs,
true,
typeof options.locale !== "undefined"
? options.locale
- : _this4.locale
+ : _this3.locale
)
)
: false;
@@ -3033,7 +3073,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
](route)
]);
- case 15:
+ case 23:
case "end":
return _context4.stop();
}
@@ -3120,7 +3160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getData",
value: function _getData(fn) {
- var _this5 = this;
+ var _this4 = this;
var cancelled = false;
@@ -3130,8 +3170,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.clc = cancel;
return fn().then(function(data) {
- if (cancel === _this5.clc) {
- _this5.clc = null;
+ if (cancel === _this4.clc) {
+ _this4.clc = null;
}
if (cancelled) {
@@ -3147,7 +3187,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getStaticData",
value: function _getStaticData(dataHref) {
- var _this6 = this;
+ var _this5 = this;
var _URL = new URL(dataHref, window.location.href),
cacheKey = _URL.href;
@@ -3157,7 +3197,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
return fetchNextData(dataHref, this.isSsr).then(function(data) {
- _this6.sdc[cacheKey] = data;
+ _this5.sdc[cacheKey] = data;
return data;
});
}
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 11.3s | 11.2s | -26ms |
nodeModulesSize | 42.7 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..db13.js gzip | 13.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..e7a0.js gzip | N/A | 13.4 kB | N/A |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_error.js | 1.01 MB | 1.01 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
500.html | 2.65 kB | 2.65 kB | ✓ |
amp.amp.html | 10.4 kB | 10.4 kB | ✓ |
amp.html | 1.86 kB | 1.86 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1.01 MB | 1.01 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.06 MB | 1.06 MB | |
withRouter.js | 1.06 MB | 1.06 MB | |
Overall change | 5.21 MB | 5.21 MB |
Webpack 5 Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 11.4s | 11.3s | -65ms |
nodeModulesSize | 42.7 MB | 42.7 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.732 | 1.868 | |
/ avg req/sec | 1443.51 | 1337.99 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.137 | 1.124 | -0.01 |
/error-in-render avg req/sec | 2198.75 | 2224.15 | +25.4 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
597-3917a1f0..7bfd.js gzip | 13.2 kB | 13.3 kB | |
framework.HASH.js gzip | 39.3 kB | 39.3 kB | ✓ |
main-HASH.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-HASH.js gzip | 954 B | 954 B | ✓ |
Overall change | 60 kB | 60.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.1 kB | 31.1 kB | ✓ |
Overall change | 31.1 kB | 31.1 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-aedc815..1421.js gzip | 1.26 kB | 1.26 kB | ✓ |
_error-71ec2..1a96.js gzip | 3.38 kB | 3.38 kB | ✓ |
amp-33a09cb0..6745.js gzip | 536 B | 536 B | ✓ |
hooks-4e968a..f870.js gzip | 902 B | 902 B | ✓ |
index-5c6845..f75c.js gzip | 230 B | 230 B | ✓ |
link-99f0c6c..b84a.js gzip | 1.65 kB | 1.65 kB | ✓ |
routerDirect..bb56.js gzip | 306 B | 306 B | ✓ |
withRouter-7..2133.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.57 kB | 8.57 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 326 B | 326 B | ✓ |
Overall change | 326 B | 326 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 586 B | 587 B | |
link.html gzip | 592 B | 593 B | |
withRouter.html gzip | 581 B | 581 B | ✓ |
Overall change | 1.76 kB | 1.76 kB |
Diffs
Diff for 677f882d2ed8..7d7a7db13.js
@@ -719,74 +719,75 @@
0;
return !1;
}),
- (e.addLocale = b),
- (e.delLocale = _),
- (e.hasBasePath = P),
- (e.addBasePath = k),
- (e.delBasePath = S),
- (e.isLocalURL = E),
- (e.interpolateAs = R),
- (e.resolveHref = C),
+ (e.addLocale = _),
+ (e.delLocale = x),
+ (e.hasBasePath = k),
+ (e.addBasePath = S),
+ (e.delBasePath = E),
+ (e.isLocalURL = R),
+ (e.interpolateAs = L),
+ (e.resolveHref = O),
(e.default = void 0);
var s = r("X24+"),
c = r("Nh2W"),
l = r("wkBG"),
- f = (r("3wub"), g(r("dZ6Y"))),
+ f = (r("3wub"), w(r("dZ6Y"))),
h = r("g/15"),
p = r("/jkW"),
d = r("hS4m"),
v = r("3WeD"),
- y = (g(r("GXs3")), r("gguc")),
- m = r("YTqd");
- function g(t) {
+ y = w(r("GXs3")),
+ m = r("gguc"),
+ g = r("YTqd");
+ function w(t) {
return t && t.__esModule ? t : { default: t };
}
- function w() {
+ function b() {
return Object.assign(new Error("Route Cancelled"), { cancelled: !0 });
}
- function b(t, e, r) {
+ function _(t, e, r) {
return t;
}
- function _(t, e) {
+ function x(t, e) {
return t;
}
- function x(t) {
+ function P(t) {
var e = t.indexOf("?"),
r = t.indexOf("#");
return (e > -1 || r > -1) && (t = t.substring(0, e > -1 ? e : r)), t;
}
- function P(t) {
- return "" === (t = x(t)) || t.startsWith("/");
- }
function k(t) {
+ return "" === (t = P(t)) || t.startsWith("/");
+ }
+ function S(t) {
return (function(t, e) {
return e && t.startsWith("/")
? "/" === t
? (0, s.normalizePathTrailingSlash)(e)
- : "".concat(e).concat("/" === x(t) ? t.substring(1) : t)
+ : "".concat(e).concat("/" === P(t) ? t.substring(1) : t)
: t;
})(t, "");
}
- function S(t) {
+ function E(t) {
return (
(t = t.slice("".length)).startsWith("/") || (t = "/".concat(t)), t
);
}
- function E(t) {
+ function R(t) {
if (t.startsWith("/") || t.startsWith("#")) return !0;
try {
var e = (0, h.getLocationOrigin)(),
r = new URL(t, e);
- return r.origin === e && P(r.pathname);
+ return r.origin === e && k(r.pathname);
} catch (n) {
return !1;
}
}
- function R(t, e, r) {
+ function L(t, e, r) {
var n = "",
- o = (0, m.getRouteRegex)(t),
+ o = (0, g.getRouteRegex)(t),
a = o.groups,
- i = (e !== t ? (0, y.getRouteMatcher)(o)(e) : "") || r;
+ i = (e !== t ? (0, m.getRouteMatcher)(o)(e) : "") || r;
n = t;
var u = Object.keys(a);
return (
@@ -816,7 +817,7 @@
{ params: u, result: n }
);
}
- function L(t, e) {
+ function C(t, e) {
var r = {};
return (
Object.keys(t).forEach(function(n) {
@@ -825,24 +826,24 @@
r
);
}
- function C(t, e, r) {
+ function O(t, e, r) {
var n = new URL(t, "http://n"),
o = "string" === typeof e ? e : (0, h.formatWithValidation)(e);
- if (!E(o)) return r ? [o] : o;
+ if (!R(o)) return r ? [o] : o;
try {
var a = new URL(o, n);
a.pathname = (0, s.normalizePathTrailingSlash)(a.pathname);
var i = "";
if ((0, p.isDynamicRoute)(a.pathname) && a.searchParams && r) {
var u = (0, v.searchParamsToUrlQuery)(a.searchParams),
- c = R(a.pathname, a.pathname, u),
+ c = L(a.pathname, a.pathname, u),
l = c.result,
f = c.params;
l &&
(i = (0, h.formatWithValidation)({
pathname: l,
hash: a.hash,
- query: L(u, f)
+ query: C(u, f)
}));
}
var d =
@@ -852,31 +853,53 @@
return r ? [o] : o;
}
}
- function O(t) {
+ function I(t) {
var e = (0, h.getLocationOrigin)();
return t.startsWith(e) ? t.substring(e.length) : t;
}
- function I(t, e, r) {
- var n = C(t.pathname, e, !0),
+ function T(t, e, r) {
+ var n = O(t.pathname, e, !0),
o = u(n, 2),
a = o[0],
i = o[1],
s = (0, h.getLocationOrigin)(),
c = a.startsWith(s),
l = i && i.startsWith(s);
- (a = O(a)), (i = i ? O(i) : i);
- var f = c ? a : k(a),
- p = r ? O(C(t.pathname, r)) : i || a;
- return { url: f, as: l ? p : k(p) };
+ (a = I(a)), (i = i ? I(i) : i);
+ var f = c ? a : S(a),
+ p = r ? I(O(t.pathname, r)) : i || a;
+ return { url: f, as: l ? p : S(p) };
}
- var T = Symbol("SSG_DATA_NOT_FOUND");
function j(t, e) {
+ var r =
+ !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2],
+ n = t.pathname,
+ o = (0, s.removePathTrailingSlash)(
+ (0, l.denormalizePagePath)(r ? E(n) : n)
+ );
+ return (
+ "/404" === o ||
+ "/_error" === o ||
+ (e.includes(o) ||
+ e.some(function(e) {
+ if (
+ (0, p.isDynamicRoute)(e) &&
+ (0, g.getRouteRegex)(e).re.test(o)
+ )
+ return (t.pathname = r ? S(e) : e), !0;
+ }),
+ (t.pathname = (0, s.removePathTrailingSlash)(t.pathname))),
+ t
+ );
+ }
+ var A = Symbol("SSG_DATA_NOT_FOUND");
+ function D(t, e) {
return fetch(t, { credentials: "same-origin" }).then(function(r) {
if (!r.ok) {
- if (e > 1 && r.status >= 500) return j(t, e - 1);
+ if (e > 1 && r.status >= 500) return D(t, e - 1);
if (404 === r.status)
return r.json().then(function(t) {
- if (t.notFound) return { notFound: T };
+ if (t.notFound) return { notFound: A };
throw new Error("Failed to load static props");
});
throw new Error("Failed to load static props");
@@ -884,12 +907,12 @@
return r.json();
});
}
- function A(t, e) {
- return j(t, e ? 3 : 1).catch(function(t) {
+ function M(t, e) {
+ return D(t, e ? 3 : 1).catch(function(t) {
throw (e || (0, c.markAssetError)(t), t);
});
}
- var D = (function() {
+ var N = (function() {
function t(e, r, n, o) {
var i = this,
u = o.initialProps,
@@ -956,7 +979,7 @@
c = i.query;
i.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(s), query: c }),
+ (0, h.formatWithValidation)({ pathname: S(s), query: c }),
(0, h.getURL)()
);
}
@@ -995,7 +1018,7 @@
"//" !== n.substr(0, 2) &&
this.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(e), query: r }),
+ (0, h.formatWithValidation)({ pathname: S(e), query: r }),
(0, h.getURL)(),
{ locale: w }
),
@@ -1022,7 +1045,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {};
- var n = I(this, t, e);
+ var n = T(this, t, e);
return (
(t = n.url), (e = n.as), this.change("pushState", t, e, r)
);
@@ -1035,7 +1058,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {},
- n = I(this, t, e);
+ n = T(this, t, e);
return (
(t = n.url), (e = n.as), this.change("replaceState", t, e, r)
);
@@ -1049,13 +1072,12 @@
var l,
f,
v,
- g,
+ y,
w,
- x,
- C,
+ b,
+ P,
O,
- j,
- A,
+ I,
D,
M,
N,
@@ -1065,8 +1087,8 @@
F,
G,
B,
- H,
V,
+ H,
X,
z,
J,
@@ -1080,13 +1102,14 @@
rt,
nt,
ot,
- at;
+ at,
+ it;
return n.wrap(
function(e) {
for (;;)
switch ((e.prev = e.next)) {
case 0:
- if (E(o)) {
+ if (R(o)) {
e.next = 3;
break;
}
@@ -1105,20 +1128,20 @@
(i._h || (this.isSsr = !1),
h.ST && performance.mark("routeChange"),
(v = i.shallow),
- (g = { shallow: void 0 !== v && v }),
+ (y = { shallow: void 0 !== v && v }),
this._inFlightRoute &&
this.abortComponentLoad(
this._inFlightRoute,
- g
+ y
),
- (a = k(
- b(
- P(a) ? S(a) : a,
+ (a = S(
+ _(
+ k(a) ? E(a) : a,
i.locale,
this.defaultLocale
)
)),
- (w = _(P(a) ? S(a) : a, this.locale)),
+ (w = x(k(a) ? E(a) : a, this.locale)),
(this._inFlightRoute = a),
i._h || !this.onlyAHashChange(w))
) {
@@ -1127,30 +1150,30 @@
}
return (
(this.asPath = w),
- t.events.emit("hashChangeStart", a, g),
+ t.events.emit("hashChangeStart", a, y),
this.changeState(r, o, a, i),
this.scrollToHash(w),
this.notify(this.components[this.route], null),
- t.events.emit("hashChangeComplete", a, g),
+ t.events.emit("hashChangeComplete", a, y),
e.abrupt("return", !0)
);
case 34:
return (
- (x = (0, d.parseRelativeUrl)(o)),
- (O = (C = x).pathname),
- (j = C.query),
+ (b = (0, d.parseRelativeUrl)(o)),
+ (O = (P = b).pathname),
+ (I = P.query),
(e.prev = 36),
(e.next = 39),
this.pageLoader.getPageList()
);
case 39:
return (
- (A = e.sent),
+ (D = e.sent),
(e.next = 42),
(0, c.getClientBuildManifest)()
);
case 42:
- (D = e.sent), D.__rewrites, (e.next = 50);
+ (M = e.sent), M.__rewrites, (e.next = 50);
break;
case 46:
return (
@@ -1161,16 +1184,16 @@
);
case 50:
if (
- ((x = this._resolveHref(x, A)).pathname !== O &&
- ((O = x.pathname),
- (o = (0, h.formatWithValidation)(x))),
+ ((b = j(b, D)).pathname !== O &&
+ ((O = b.pathname),
+ (o = (0, h.formatWithValidation)(b))),
(O = O
- ? (0, s.removePathTrailingSlash)(S(O))
+ ? (0, s.removePathTrailingSlash)(E(O))
: O),
this.urlIsNew(w) || f || (r = "replaceState"),
- (M = (0, s.removePathTrailingSlash)(O)),
- (N = a),
- E(a))
+ (N = (0, s.removePathTrailingSlash)(O)),
+ (U = a),
+ R(a))
) {
e.next = 62;
break;
@@ -1184,29 +1207,29 @@
);
case 62:
if (
- ((N = _(S(N), this.locale)),
- !(0, p.isDynamicRoute)(M))
+ ((U = x(E(U), this.locale)),
+ !(0, p.isDynamicRoute)(N))
) {
e.next = 78;
break;
}
if (
- ((U = (0, d.parseRelativeUrl)(N)),
- (W = U.pathname),
- (q = (0, m.getRouteRegex)(M)),
- (F = (0, y.getRouteMatcher)(q)(W)),
- (B = (G = M === W) ? R(M, W, j) : {}),
- F && (!G || B.result))
+ ((W = (0, d.parseRelativeUrl)(U)),
+ (q = W.pathname),
+ (F = (0, g.getRouteRegex)(N)),
+ (G = (0, m.getRouteMatcher)(F)(q)),
+ (V = (B = N === q) ? L(N, q, I) : {}),
+ G && (!B || V.result))
) {
e.next = 77;
break;
}
if (
!(
- (H = Object.keys(q.groups).filter(function(
+ (H = Object.keys(F.groups).filter(function(
t
) {
- return !j[t];
+ return !I[t];
})).length > 0
)
) {
@@ -1214,7 +1237,7 @@
break;
}
throw new Error(
- (G
+ (B
? "The provided `href` ("
.concat(
o,
@@ -1226,12 +1249,12 @@
)
: "The provided `as` value ("
.concat(
- W,
+ q,
") is incompatible with the `href` value ("
)
- .concat(M, "). ")) +
+ .concat(N, "). ")) +
"Read more: https://err.sh/vercel/next.js/".concat(
- G
+ B
? "href-interpolation-failed"
: "incompatible-href-as"
)
@@ -1240,66 +1263,65 @@
e.next = 78;
break;
case 77:
- G
+ B
? (a = (0, h.formatWithValidation)(
- Object.assign({}, U, {
- pathname: B.result,
- query: L(j, B.params)
+ Object.assign({}, W, {
+ pathname: V.result,
+ query: C(I, V.params)
})
))
- : Object.assign(j, F);
+ : Object.assign(I, G);
case 78:
return (
- t.events.emit("routeChangeStart", a, g),
+ t.events.emit("routeChangeStart", a, y),
(e.prev = 79),
(e.next = 82),
- this.getRouteInfo(M, O, j, a, N, g)
+ this.getRouteInfo(N, O, I, a, U, y)
);
case 82:
if (
- ((z = e.sent),
- ($ = (J = z).error),
- (Y = J.props),
- (Q = J.__N_SSG),
- (Z = J.__N_SSP),
- (!Q && !Z) || !Y)
+ ((J = e.sent),
+ (Y = ($ = J).error),
+ (Q = $.props),
+ (Z = $.__N_SSG),
+ (K = $.__N_SSP),
+ (!Z && !K) || !Q)
) {
e.next = 109;
break;
}
- if (!Y.pageProps || !Y.pageProps.__N_REDIRECT) {
+ if (!Q.pageProps || !Q.pageProps.__N_REDIRECT) {
e.next = 95;
break;
}
if (
- !(K = Y.pageProps.__N_REDIRECT).startsWith("/")
+ !(tt = Q.pageProps.__N_REDIRECT).startsWith("/")
) {
e.next = 93;
break;
}
if (
- ((tt = (0, d.parseRelativeUrl)(K)),
- this._resolveHref(tt, A, !1),
- !A.includes(tt.pathname))
+ (j((et = (0, d.parseRelativeUrl)(tt)), D, !1),
+ !D.includes(et.pathname))
) {
e.next = 93;
break;
}
return (
- (et = I(this, K, K)),
- (rt = et.url),
- (nt = et.as),
- e.abrupt("return", this.change(r, rt, nt, i))
+ (rt = T(this, tt, tt)),
+ (nt = rt.url),
+ (ot = rt.as),
+ e.abrupt("return", this.change(r, nt, ot, i))
);
case 93:
return (
- (window.location.href = K),
+ (window.location.href = tt),
e.abrupt("return", new Promise(function() {}))
);
case 95:
if (
- ((this.isPreview = !!Y.__N_PREVIEW),
- Y.notFound !== T)
+ ((this.isPreview = !!Q.__N_PREVIEW),
+ Q.notFound !== A)
) {
e.next = 109;
break;
@@ -1310,59 +1332,59 @@
this.fetchComponent("/404")
);
case 100:
- (ot = "/404"), (e.next = 106);
+ (at = "/404"), (e.next = 106);
break;
case 103:
(e.prev = 103),
(e.t1 = e.catch(97)),
- (ot = "/_error");
+ (at = "/_error");
case 106:
return (
(e.next = 108),
- this.getRouteInfo(ot, ot, j, a, N, {
+ this.getRouteInfo(at, at, I, a, U, {
shallow: !1
})
);
case 108:
- z = e.sent;
+ J = e.sent;
case 109:
return (
- t.events.emit("beforeHistoryChange", a, g),
+ t.events.emit("beforeHistoryChange", a, y),
this.changeState(r, o, a, i),
- (at = i.shallow && this.route === M),
+ (it = i.shallow && this.route === N),
i._h &&
"/_error" === O &&
500 ===
- (null == (V = self.__NEXT_DATA__.props) ||
- null == (X = V.pageProps)
+ (null == (X = self.__NEXT_DATA__.props) ||
+ null == (z = X.pageProps)
? void 0
- : X.statusCode) &&
- null != Y &&
- Y.pageProps &&
- (Y.pageProps.statusCode = 500),
+ : z.statusCode) &&
+ null != Q &&
+ Q.pageProps &&
+ (Q.pageProps.statusCode = 500),
(e.next = 116),
this.set(
- M,
+ N,
O,
- j,
+ I,
w,
- z,
- u || (at || !i.scroll ? null : { x: 0, y: 0 })
+ J,
+ u || (it || !i.scroll ? null : { x: 0, y: 0 })
).catch(function(t) {
if (!t.cancelled) throw t;
- $ = $ || t;
+ Y = Y || t;
})
);
case 116:
- if (!$) {
+ if (!Y) {
e.next = 119;
break;
}
- throw (t.events.emit("routeChangeError", $, w, g),
- $);
+ throw (t.events.emit("routeChangeError", Y, w, y),
+ Y);
case 119:
return (
- t.events.emit("routeChangeComplete", a, g),
+ t.events.emit("routeChangeComplete", a, y),
e.abrupt("return", !0)
);
case 124:
@@ -1443,7 +1465,7 @@
}
throw (t.events.emit("routeChangeError", r, i, u),
(window.location.href = i),
- w());
+ b());
case 6:
if (
((e.prev = 6),
@@ -1696,32 +1718,6 @@
return this.asPath !== t;
}
},
- {
- key: "_resolveHref",
- value: function(t, e) {
- var r =
- !(arguments.length > 2 && void 0 !== arguments[2]) ||
- arguments[2],
- n = t.pathname,
- o = (0, s.removePathTrailingSlash)(
- (0, l.denormalizePagePath)(r ? S(n) : n)
- );
- return (
- "/404" === o ||
- "/_error" === o ||
- (e.includes(o) ||
- e.some(function(e) {
- if (
- (0, p.isDynamicRoute)(e) &&
- (0, m.getRouteRegex)(e).re.test(o)
- )
- return (t.pathname = r ? k(e) : e), !0;
- }),
- (t.pathname = (0, s.removePathTrailingSlash)(t.pathname))),
- t
- );
- }
- },
{
key: "prefetch",
value: (function() {
@@ -1733,8 +1729,12 @@
i,
u,
c,
- l = this,
- f = arguments;
+ l,
+ f,
+ p,
+ v,
+ m = this,
+ g = arguments;
return n.wrap(
function(t) {
for (;;)
@@ -1742,9 +1742,9 @@
case 0:
return (
(r =
- f.length > 1 && void 0 !== f[1] ? f[1] : e),
+ g.length > 1 && void 0 !== g[1] ? g[1] : e),
(o =
- f.length > 2 && void 0 !== f[2] ? f[2] : {}),
+ g.length > 2 && void 0 !== g[2] ? g[2] : {}),
(a = (0, d.parseRelativeUrl)(e)),
(i = a.pathname),
(t.next = 7),
@@ -1752,28 +1752,50 @@
);
case 7:
(u = t.sent),
- (a = this._resolveHref(a, u, !1)).pathname !==
- i &&
+ (a = j(a, u, !1)).pathname !== i &&
((i = a.pathname),
(e = (0, h.formatWithValidation)(a))),
- (t.next = 12);
+ (c = (0, s.removePathTrailingSlash)(i)),
+ (l = r),
+ (t.next = 19);
break;
- case 12:
+ case 15:
+ (p = t.sent),
+ (f = p.__rewrites),
+ (v = (0, y.default)(
+ S(_(E(r), this.locale)),
+ u,
+ f,
+ a.query,
+ function(t) {
+ return j({ pathname: t }, u).pathname;
+ },
+ this.locales
+ )).matchedPage &&
+ v.resolvedHref &&
+ ((c = v.resolvedHref),
+ (i = v.resolvedHref),
+ (a.pathname = i),
+ (e = (0, h.formatWithValidation)(a)),
+ (l = v.asPath));
+ case 19:
+ t.next = 21;
+ break;
+ case 21:
return (
- (c = (0, s.removePathTrailingSlash)(i)),
- (t.next = 15),
+ (t.next = 23),
Promise.all([
this.pageLoader._isSsg(e).then(function(t) {
return (
!!t &&
- l._getStaticData(
- l.pageLoader.getDataHref(
+ m._getStaticData(
+ m.pageLoader.getDataHref(
e,
- r,
+ l,
!0,
"undefined" !== typeof o.locale
? o.locale
- : l.locale
+ : m.locale
)
)
);
@@ -1783,7 +1805,7 @@
](c)
])
);
- case 15:
+ case 23:
case "end":
return t.stop();
}
@@ -1876,7 +1898,7 @@
r = new URL(t, window.location.href).href;
return !this.isPreview && this.sdc[r]
? Promise.resolve(this.sdc[r])
- : A(t, this.isSsr).then(function(t) {
+ : M(t, this.isSsr).then(function(t) {
return (e.sdc[r] = t), t;
});
}
@@ -1884,7 +1906,7 @@
{
key: "_getServerData",
value: function(t) {
- return A(t, this.isSsr);
+ return M(t, this.isSsr);
}
},
{
@@ -1907,7 +1929,7 @@
key: "abortComponentLoad",
value: function(e, r) {
this.clc &&
- (t.events.emit("routeChangeError", w(), e, r),
+ (t.events.emit("routeChangeError", b(), e, r),
this.clc(),
(this.clc = null));
}
@@ -1922,7 +1944,7 @@
t
);
})();
- (e.default = D), (D.events = (0, f.default)());
+ (e.default = N), (N.events = (0, f.default)());
},
"g/15": function(t, e, r) {
"use strict";
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/",
"query": {},
- "buildId": "UvRzF08syCl1TOTNSFCgq",
+ "buildId": "twm_S0SV_o6ahlqQ5pkxE",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/UvRzF08syCl1TOTNSFCgq/_buildManifest.js"
+ src="/_next/static/twm_S0SV_o6ahlqQ5pkxE/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/UvRzF08syCl1TOTNSFCgq/_ssgManifest.js"
+ src="/_next/static/twm_S0SV_o6ahlqQ5pkxE/_ssgManifest.js"
async=""
></script>
</body>
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -48,7 +48,7 @@
"props": { "pageProps": {} },
"page": "/link",
"query": {},
- "buildId": "UvRzF08syCl1TOTNSFCgq",
+ "buildId": "twm_S0SV_o6ahlqQ5pkxE",
"isFallback": false,
"gip": true
}
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -82,11 +82,11 @@
async=""
></script>
<script
- src="/_next/static/UvRzF08syCl1TOTNSFCgq/_buildManifest.js"
+ src="/_next/static/twm_S0SV_o6ahlqQ5pkxE/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/UvRzF08syCl1TOTNSFCgq/_ssgManifest.js"
+ src="/_next/static/twm_S0SV_o6ahlqQ5pkxE/_ssgManifest.js"
async=""
></script>
</body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/withRouter",
"query": {},
- "buildId": "UvRzF08syCl1TOTNSFCgq",
+ "buildId": "twm_S0SV_o6ahlqQ5pkxE",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/UvRzF08syCl1TOTNSFCgq/_buildManifest.js"
+ src="/_next/static/twm_S0SV_o6ahlqQ5pkxE/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/UvRzF08syCl1TOTNSFCgq/_ssgManifest.js"
+ src="/_next/static/twm_S0SV_o6ahlqQ5pkxE/_ssgManifest.js"
async=""
></script>
</body>
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 11.8s | 11.7s | -46ms |
nodeModulesSize | 42.7 MB | 42.7 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.269 | 2.173 | -0.1 |
/ avg req/sec | 1101.63 | 1150.41 | +48.78 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.549 | 1.561 | |
/error-in-render avg req/sec | 1614.36 | 1601.52 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..db13.js gzip | 13.3 kB | 13.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 614 B | 612 B | -2 B |
link.html gzip | 619 B | 619 B | ✓ |
withRouter.html gzip | 608 B | 607 B | -1 B |
Overall change | 1.84 kB | 1.84 kB | -3 B |
Diffs
Diff for 677f882d2ed8..2f1e56545.js
@@ -1492,6 +1492,41 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
};
}
+ function resolveDynamicRoute(parsedHref, pages) {
+ var applyBasePath =
+ arguments.length > 2 && arguments[2] !== undefined
+ ? arguments[2]
+ : true;
+ var pathname = parsedHref.pathname;
+ var cleanPathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(
+ (0, _denormalizePagePath.denormalizePagePath)(
+ applyBasePath ? delBasePath(pathname) : pathname
+ )
+ );
+
+ if (cleanPathname === "/404" || cleanPathname === "/_error") {
+ return parsedHref;
+ } // handle resolving href for dynamic routes
+
+ if (!pages.includes(cleanPathname)) {
+ // eslint-disable-next-line array-callback-return
+ pages.some(function(page) {
+ if (
+ (0, _isDynamic.isDynamicRoute)(page) &&
+ (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
+ ) {
+ parsedHref.pathname = applyBasePath ? addBasePath(page) : page;
+ return true;
+ }
+ });
+ }
+
+ parsedHref.pathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(parsedHref.pathname);
+ return parsedHref;
+ }
+
var manualScrollRestoration = false && false;
var SSG_DATA_NOT_FOUND = Symbol("SSG_DATA_NOT_FOUND");
@@ -1827,8 +1862,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
options,
forcedScroll
) {
- var _this2 = this;
-
var _options$scroll,
localeChange,
parsedAs,
@@ -2066,7 +2099,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 50:
- parsed = this._resolveHref(parsed, pages);
+ parsed = resolveDynamicRoute(parsed, pages);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
@@ -2265,8 +2298,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
parsedHref = (0,
_parseRelativeUrl.parseRelativeUrl)(destination);
-
- this._resolveHref(parsedHref, pages, false);
+ resolveDynamicRoute(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
_context.next = 93;
@@ -2641,7 +2673,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
resolvedAs,
routeProps
) {
- var _this3 = this;
+ var _this2 = this;
var existingRouteInfo,
cachedRouteInfo,
@@ -2761,10 +2793,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_context3.next = 21;
return this._getData(function() {
return __N_SSG
- ? _this3._getStaticData(dataHref)
+ ? _this2._getStaticData(dataHref)
: __N_SSP
- ? _this3._getServerData(dataHref)
- : _this3.getInitialProps(
+ ? _this2._getServerData(dataHref)
+ : _this2.getInitialProps(
Component, // we provide AppTree later so this needs to be `any`
{
pathname: pathname,
@@ -2901,47 +2933,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: function urlIsNew(asPath) {
return this.asPath !== asPath;
}
- },
- {
- key: "_resolveHref",
- value: function _resolveHref(parsedHref, pages) {
- var applyBasePath =
- arguments.length > 2 && arguments[2] !== undefined
- ? arguments[2]
- : true;
- var pathname = parsedHref.pathname;
- var cleanPathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- (0, _denormalizePagePath.denormalizePagePath)(
- applyBasePath ? delBasePath(pathname) : pathname
- )
- );
-
- if (cleanPathname === "/404" || cleanPathname === "/_error") {
- return parsedHref;
- } // handle resolving href for dynamic routes
-
- if (!pages.includes(cleanPathname)) {
- // eslint-disable-next-line array-callback-return
- pages.some(function(page) {
- if (
- (0, _isDynamic.isDynamicRoute)(page) &&
- (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
- ) {
- parsedHref.pathname = applyBasePath
- ? addBasePath(page)
- : page;
- return true;
- }
- });
- }
-
- parsedHref.pathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- parsedHref.pathname
- );
- return parsedHref;
- }
/**
* Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
@@ -2954,7 +2945,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: (function() {
var _prefetch = _asyncToGenerator(
/*#__PURE__*/ _regeneratorRuntime.mark(function _callee4(url) {
- var _this4 = this;
+ var _this3 = this;
var asPath,
options,
@@ -2965,6 +2956,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
localePathResult,
pages,
route,
+ resolvedAs,
+ rewrites,
+ _yield2,
+ rewritesResult,
_args4 = arguments;
return _regeneratorRuntime.wrap(
@@ -2993,37 +2988,82 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 7:
pages = _context4.sent;
- parsed = this._resolveHref(parsed, pages, false);
+ parsed = resolveDynamicRoute(parsed, pages, false);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
url = (0, _utils.formatWithValidation)(parsed);
- } // Prefetch is not supported in development mode because it would trigger on-demand-entries
-
- if (true) {
- _context4.next = 12;
- break;
}
- return _context4.abrupt("return");
-
- case 12:
route = (0,
_normalizeTrailingSlash.removePathTrailingSlash)(
pathname
);
+ resolvedAs = asPath;
+
+ if (true) {
+ _context4.next = 19;
+ break;
+ }
+
_context4.next = 15;
+ return (0, _routeLoader.getClientBuildManifest)();
+
+ case 15:
+ _yield2 = _context4.sent;
+ rewrites = _yield2.__rewrites;
+ rewritesResult = (0, _resolveRewrites["default"])(
+ addBasePath(
+ addLocale(delBasePath(asPath), this.locale)
+ ),
+ pages,
+ rewrites,
+ parsed.query,
+ function(p) {
+ return resolveDynamicRoute(
+ {
+ pathname: p
+ },
+ pages
+ ).pathname;
+ },
+ this.locales
+ );
+
+ if (
+ rewritesResult.matchedPage &&
+ rewritesResult.resolvedHref
+ ) {
+ // if this directly matches a page we need to update the href to
+ // allow the correct page chunk to be loaded
+ route = rewritesResult.resolvedHref;
+ pathname = rewritesResult.resolvedHref;
+ parsed.pathname = pathname;
+ url = (0, _utils.formatWithValidation)(parsed);
+ resolvedAs = rewritesResult.asPath;
+ }
+
+ case 19:
+ if (true) {
+ _context4.next = 21;
+ break;
+ }
+
+ return _context4.abrupt("return");
+
+ case 21:
+ _context4.next = 23;
return Promise.all([
this.pageLoader._isSsg(url).then(function(isSsg) {
return isSsg
- ? _this4._getStaticData(
- _this4.pageLoader.getDataHref(
+ ? _this3._getStaticData(
+ _this3.pageLoader.getDataHref(
url,
- asPath,
+ resolvedAs,
true,
typeof options.locale !== "undefined"
? options.locale
- : _this4.locale
+ : _this3.locale
)
)
: false;
@@ -3033,7 +3073,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
](route)
]);
- case 15:
+ case 23:
case "end":
return _context4.stop();
}
@@ -3120,7 +3160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getData",
value: function _getData(fn) {
- var _this5 = this;
+ var _this4 = this;
var cancelled = false;
@@ -3130,8 +3170,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.clc = cancel;
return fn().then(function(data) {
- if (cancel === _this5.clc) {
- _this5.clc = null;
+ if (cancel === _this4.clc) {
+ _this4.clc = null;
}
if (cancelled) {
@@ -3147,7 +3187,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getStaticData",
value: function _getStaticData(dataHref) {
- var _this6 = this;
+ var _this5 = this;
var _URL = new URL(dataHref, window.location.href),
cacheKey = _URL.href;
@@ -3157,7 +3197,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
return fetchNextData(dataHref, this.isSsr).then(function(data) {
- _this6.sdc[cacheKey] = data;
+ _this5.sdc[cacheKey] = data;
return data;
});
}
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 13.9s | 14.1s | |
nodeModulesSize | 42.7 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..db13.js gzip | 13.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..e7a0.js gzip | N/A | 13.4 kB | N/A |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_error.js | 1.01 MB | 1.01 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
500.html | 2.65 kB | 2.65 kB | ✓ |
amp.amp.html | 10.4 kB | 10.4 kB | ✓ |
amp.html | 1.86 kB | 1.86 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1.01 MB | 1.01 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.06 MB | 1.06 MB | |
withRouter.js | 1.06 MB | 1.06 MB | |
Overall change | 5.21 MB | 5.21 MB |
Webpack 5 Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 14.2s | 14.1s | -34ms |
nodeModulesSize | 42.7 MB | 42.7 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.249 | 2.212 | -0.04 |
/ avg req/sec | 1111.58 | 1130.22 | +18.64 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.499 | 1.479 | -0.02 |
/error-in-render avg req/sec | 1667.91 | 1690.17 | +22.26 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
597-3917a1f0..7bfd.js gzip | 13.2 kB | 13.3 kB | |
framework.HASH.js gzip | 39.3 kB | 39.3 kB | ✓ |
main-HASH.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-HASH.js gzip | 954 B | 954 B | ✓ |
Overall change | 60 kB | 60.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.1 kB | 31.1 kB | ✓ |
Overall change | 31.1 kB | 31.1 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-aedc815..1421.js gzip | 1.26 kB | 1.26 kB | ✓ |
_error-71ec2..1a96.js gzip | 3.38 kB | 3.38 kB | ✓ |
amp-33a09cb0..6745.js gzip | 536 B | 536 B | ✓ |
hooks-4e968a..f870.js gzip | 902 B | 902 B | ✓ |
index-5c6845..f75c.js gzip | 230 B | 230 B | ✓ |
link-99f0c6c..b84a.js gzip | 1.65 kB | 1.65 kB | ✓ |
routerDirect..bb56.js gzip | 306 B | 306 B | ✓ |
withRouter-7..2133.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.57 kB | 8.57 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 326 B | 326 B | ✓ |
Overall change | 326 B | 326 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 586 B | 587 B | |
link.html gzip | 592 B | 593 B | |
withRouter.html gzip | 581 B | 581 B | ✓ |
Overall change | 1.76 kB | 1.76 kB |
Diffs
Diff for 677f882d2ed8..7d7a7db13.js
@@ -719,74 +719,75 @@
0;
return !1;
}),
- (e.addLocale = b),
- (e.delLocale = _),
- (e.hasBasePath = P),
- (e.addBasePath = k),
- (e.delBasePath = S),
- (e.isLocalURL = E),
- (e.interpolateAs = R),
- (e.resolveHref = C),
+ (e.addLocale = _),
+ (e.delLocale = x),
+ (e.hasBasePath = k),
+ (e.addBasePath = S),
+ (e.delBasePath = E),
+ (e.isLocalURL = R),
+ (e.interpolateAs = L),
+ (e.resolveHref = O),
(e.default = void 0);
var s = r("X24+"),
c = r("Nh2W"),
l = r("wkBG"),
- f = (r("3wub"), g(r("dZ6Y"))),
+ f = (r("3wub"), w(r("dZ6Y"))),
h = r("g/15"),
p = r("/jkW"),
d = r("hS4m"),
v = r("3WeD"),
- y = (g(r("GXs3")), r("gguc")),
- m = r("YTqd");
- function g(t) {
+ y = w(r("GXs3")),
+ m = r("gguc"),
+ g = r("YTqd");
+ function w(t) {
return t && t.__esModule ? t : { default: t };
}
- function w() {
+ function b() {
return Object.assign(new Error("Route Cancelled"), { cancelled: !0 });
}
- function b(t, e, r) {
+ function _(t, e, r) {
return t;
}
- function _(t, e) {
+ function x(t, e) {
return t;
}
- function x(t) {
+ function P(t) {
var e = t.indexOf("?"),
r = t.indexOf("#");
return (e > -1 || r > -1) && (t = t.substring(0, e > -1 ? e : r)), t;
}
- function P(t) {
- return "" === (t = x(t)) || t.startsWith("/");
- }
function k(t) {
+ return "" === (t = P(t)) || t.startsWith("/");
+ }
+ function S(t) {
return (function(t, e) {
return e && t.startsWith("/")
? "/" === t
? (0, s.normalizePathTrailingSlash)(e)
- : "".concat(e).concat("/" === x(t) ? t.substring(1) : t)
+ : "".concat(e).concat("/" === P(t) ? t.substring(1) : t)
: t;
})(t, "");
}
- function S(t) {
+ function E(t) {
return (
(t = t.slice("".length)).startsWith("/") || (t = "/".concat(t)), t
);
}
- function E(t) {
+ function R(t) {
if (t.startsWith("/") || t.startsWith("#")) return !0;
try {
var e = (0, h.getLocationOrigin)(),
r = new URL(t, e);
- return r.origin === e && P(r.pathname);
+ return r.origin === e && k(r.pathname);
} catch (n) {
return !1;
}
}
- function R(t, e, r) {
+ function L(t, e, r) {
var n = "",
- o = (0, m.getRouteRegex)(t),
+ o = (0, g.getRouteRegex)(t),
a = o.groups,
- i = (e !== t ? (0, y.getRouteMatcher)(o)(e) : "") || r;
+ i = (e !== t ? (0, m.getRouteMatcher)(o)(e) : "") || r;
n = t;
var u = Object.keys(a);
return (
@@ -816,7 +817,7 @@
{ params: u, result: n }
);
}
- function L(t, e) {
+ function C(t, e) {
var r = {};
return (
Object.keys(t).forEach(function(n) {
@@ -825,24 +826,24 @@
r
);
}
- function C(t, e, r) {
+ function O(t, e, r) {
var n = new URL(t, "http://n"),
o = "string" === typeof e ? e : (0, h.formatWithValidation)(e);
- if (!E(o)) return r ? [o] : o;
+ if (!R(o)) return r ? [o] : o;
try {
var a = new URL(o, n);
a.pathname = (0, s.normalizePathTrailingSlash)(a.pathname);
var i = "";
if ((0, p.isDynamicRoute)(a.pathname) && a.searchParams && r) {
var u = (0, v.searchParamsToUrlQuery)(a.searchParams),
- c = R(a.pathname, a.pathname, u),
+ c = L(a.pathname, a.pathname, u),
l = c.result,
f = c.params;
l &&
(i = (0, h.formatWithValidation)({
pathname: l,
hash: a.hash,
- query: L(u, f)
+ query: C(u, f)
}));
}
var d =
@@ -852,31 +853,53 @@
return r ? [o] : o;
}
}
- function O(t) {
+ function I(t) {
var e = (0, h.getLocationOrigin)();
return t.startsWith(e) ? t.substring(e.length) : t;
}
- function I(t, e, r) {
- var n = C(t.pathname, e, !0),
+ function T(t, e, r) {
+ var n = O(t.pathname, e, !0),
o = u(n, 2),
a = o[0],
i = o[1],
s = (0, h.getLocationOrigin)(),
c = a.startsWith(s),
l = i && i.startsWith(s);
- (a = O(a)), (i = i ? O(i) : i);
- var f = c ? a : k(a),
- p = r ? O(C(t.pathname, r)) : i || a;
- return { url: f, as: l ? p : k(p) };
+ (a = I(a)), (i = i ? I(i) : i);
+ var f = c ? a : S(a),
+ p = r ? I(O(t.pathname, r)) : i || a;
+ return { url: f, as: l ? p : S(p) };
}
- var T = Symbol("SSG_DATA_NOT_FOUND");
function j(t, e) {
+ var r =
+ !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2],
+ n = t.pathname,
+ o = (0, s.removePathTrailingSlash)(
+ (0, l.denormalizePagePath)(r ? E(n) : n)
+ );
+ return (
+ "/404" === o ||
+ "/_error" === o ||
+ (e.includes(o) ||
+ e.some(function(e) {
+ if (
+ (0, p.isDynamicRoute)(e) &&
+ (0, g.getRouteRegex)(e).re.test(o)
+ )
+ return (t.pathname = r ? S(e) : e), !0;
+ }),
+ (t.pathname = (0, s.removePathTrailingSlash)(t.pathname))),
+ t
+ );
+ }
+ var A = Symbol("SSG_DATA_NOT_FOUND");
+ function D(t, e) {
return fetch(t, { credentials: "same-origin" }).then(function(r) {
if (!r.ok) {
- if (e > 1 && r.status >= 500) return j(t, e - 1);
+ if (e > 1 && r.status >= 500) return D(t, e - 1);
if (404 === r.status)
return r.json().then(function(t) {
- if (t.notFound) return { notFound: T };
+ if (t.notFound) return { notFound: A };
throw new Error("Failed to load static props");
});
throw new Error("Failed to load static props");
@@ -884,12 +907,12 @@
return r.json();
});
}
- function A(t, e) {
- return j(t, e ? 3 : 1).catch(function(t) {
+ function M(t, e) {
+ return D(t, e ? 3 : 1).catch(function(t) {
throw (e || (0, c.markAssetError)(t), t);
});
}
- var D = (function() {
+ var N = (function() {
function t(e, r, n, o) {
var i = this,
u = o.initialProps,
@@ -956,7 +979,7 @@
c = i.query;
i.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(s), query: c }),
+ (0, h.formatWithValidation)({ pathname: S(s), query: c }),
(0, h.getURL)()
);
}
@@ -995,7 +1018,7 @@
"//" !== n.substr(0, 2) &&
this.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(e), query: r }),
+ (0, h.formatWithValidation)({ pathname: S(e), query: r }),
(0, h.getURL)(),
{ locale: w }
),
@@ -1022,7 +1045,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {};
- var n = I(this, t, e);
+ var n = T(this, t, e);
return (
(t = n.url), (e = n.as), this.change("pushState", t, e, r)
);
@@ -1035,7 +1058,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {},
- n = I(this, t, e);
+ n = T(this, t, e);
return (
(t = n.url), (e = n.as), this.change("replaceState", t, e, r)
);
@@ -1049,13 +1072,12 @@
var l,
f,
v,
- g,
+ y,
w,
- x,
- C,
+ b,
+ P,
O,
- j,
- A,
+ I,
D,
M,
N,
@@ -1065,8 +1087,8 @@
F,
G,
B,
- H,
V,
+ H,
X,
z,
J,
@@ -1080,13 +1102,14 @@
rt,
nt,
ot,
- at;
+ at,
+ it;
return n.wrap(
function(e) {
for (;;)
switch ((e.prev = e.next)) {
case 0:
- if (E(o)) {
+ if (R(o)) {
e.next = 3;
break;
}
@@ -1105,20 +1128,20 @@
(i._h || (this.isSsr = !1),
h.ST && performance.mark("routeChange"),
(v = i.shallow),
- (g = { shallow: void 0 !== v && v }),
+ (y = { shallow: void 0 !== v && v }),
this._inFlightRoute &&
this.abortComponentLoad(
this._inFlightRoute,
- g
+ y
),
- (a = k(
- b(
- P(a) ? S(a) : a,
+ (a = S(
+ _(
+ k(a) ? E(a) : a,
i.locale,
this.defaultLocale
)
)),
- (w = _(P(a) ? S(a) : a, this.locale)),
+ (w = x(k(a) ? E(a) : a, this.locale)),
(this._inFlightRoute = a),
i._h || !this.onlyAHashChange(w))
) {
@@ -1127,30 +1150,30 @@
}
return (
(this.asPath = w),
- t.events.emit("hashChangeStart", a, g),
+ t.events.emit("hashChangeStart", a, y),
this.changeState(r, o, a, i),
this.scrollToHash(w),
this.notify(this.components[this.route], null),
- t.events.emit("hashChangeComplete", a, g),
+ t.events.emit("hashChangeComplete", a, y),
e.abrupt("return", !0)
);
case 34:
return (
- (x = (0, d.parseRelativeUrl)(o)),
- (O = (C = x).pathname),
- (j = C.query),
+ (b = (0, d.parseRelativeUrl)(o)),
+ (O = (P = b).pathname),
+ (I = P.query),
(e.prev = 36),
(e.next = 39),
this.pageLoader.getPageList()
);
case 39:
return (
- (A = e.sent),
+ (D = e.sent),
(e.next = 42),
(0, c.getClientBuildManifest)()
);
case 42:
- (D = e.sent), D.__rewrites, (e.next = 50);
+ (M = e.sent), M.__rewrites, (e.next = 50);
break;
case 46:
return (
@@ -1161,16 +1184,16 @@
);
case 50:
if (
- ((x = this._resolveHref(x, A)).pathname !== O &&
- ((O = x.pathname),
- (o = (0, h.formatWithValidation)(x))),
+ ((b = j(b, D)).pathname !== O &&
+ ((O = b.pathname),
+ (o = (0, h.formatWithValidation)(b))),
(O = O
- ? (0, s.removePathTrailingSlash)(S(O))
+ ? (0, s.removePathTrailingSlash)(E(O))
: O),
this.urlIsNew(w) || f || (r = "replaceState"),
- (M = (0, s.removePathTrailingSlash)(O)),
- (N = a),
- E(a))
+ (N = (0, s.removePathTrailingSlash)(O)),
+ (U = a),
+ R(a))
) {
e.next = 62;
break;
@@ -1184,29 +1207,29 @@
);
case 62:
if (
- ((N = _(S(N), this.locale)),
- !(0, p.isDynamicRoute)(M))
+ ((U = x(E(U), this.locale)),
+ !(0, p.isDynamicRoute)(N))
) {
e.next = 78;
break;
}
if (
- ((U = (0, d.parseRelativeUrl)(N)),
- (W = U.pathname),
- (q = (0, m.getRouteRegex)(M)),
- (F = (0, y.getRouteMatcher)(q)(W)),
- (B = (G = M === W) ? R(M, W, j) : {}),
- F && (!G || B.result))
+ ((W = (0, d.parseRelativeUrl)(U)),
+ (q = W.pathname),
+ (F = (0, g.getRouteRegex)(N)),
+ (G = (0, m.getRouteMatcher)(F)(q)),
+ (V = (B = N === q) ? L(N, q, I) : {}),
+ G && (!B || V.result))
) {
e.next = 77;
break;
}
if (
!(
- (H = Object.keys(q.groups).filter(function(
+ (H = Object.keys(F.groups).filter(function(
t
) {
- return !j[t];
+ return !I[t];
})).length > 0
)
) {
@@ -1214,7 +1237,7 @@
break;
}
throw new Error(
- (G
+ (B
? "The provided `href` ("
.concat(
o,
@@ -1226,12 +1249,12 @@
)
: "The provided `as` value ("
.concat(
- W,
+ q,
") is incompatible with the `href` value ("
)
- .concat(M, "). ")) +
+ .concat(N, "). ")) +
"Read more: https://err.sh/vercel/next.js/".concat(
- G
+ B
? "href-interpolation-failed"
: "incompatible-href-as"
)
@@ -1240,66 +1263,65 @@
e.next = 78;
break;
case 77:
- G
+ B
? (a = (0, h.formatWithValidation)(
- Object.assign({}, U, {
- pathname: B.result,
- query: L(j, B.params)
+ Object.assign({}, W, {
+ pathname: V.result,
+ query: C(I, V.params)
})
))
- : Object.assign(j, F);
+ : Object.assign(I, G);
case 78:
return (
- t.events.emit("routeChangeStart", a, g),
+ t.events.emit("routeChangeStart", a, y),
(e.prev = 79),
(e.next = 82),
- this.getRouteInfo(M, O, j, a, N, g)
+ this.getRouteInfo(N, O, I, a, U, y)
);
case 82:
if (
- ((z = e.sent),
- ($ = (J = z).error),
- (Y = J.props),
- (Q = J.__N_SSG),
- (Z = J.__N_SSP),
- (!Q && !Z) || !Y)
+ ((J = e.sent),
+ (Y = ($ = J).error),
+ (Q = $.props),
+ (Z = $.__N_SSG),
+ (K = $.__N_SSP),
+ (!Z && !K) || !Q)
) {
e.next = 109;
break;
}
- if (!Y.pageProps || !Y.pageProps.__N_REDIRECT) {
+ if (!Q.pageProps || !Q.pageProps.__N_REDIRECT) {
e.next = 95;
break;
}
if (
- !(K = Y.pageProps.__N_REDIRECT).startsWith("/")
+ !(tt = Q.pageProps.__N_REDIRECT).startsWith("/")
) {
e.next = 93;
break;
}
if (
- ((tt = (0, d.parseRelativeUrl)(K)),
- this._resolveHref(tt, A, !1),
- !A.includes(tt.pathname))
+ (j((et = (0, d.parseRelativeUrl)(tt)), D, !1),
+ !D.includes(et.pathname))
) {
e.next = 93;
break;
}
return (
- (et = I(this, K, K)),
- (rt = et.url),
- (nt = et.as),
- e.abrupt("return", this.change(r, rt, nt, i))
+ (rt = T(this, tt, tt)),
+ (nt = rt.url),
+ (ot = rt.as),
+ e.abrupt("return", this.change(r, nt, ot, i))
);
case 93:
return (
- (window.location.href = K),
+ (window.location.href = tt),
e.abrupt("return", new Promise(function() {}))
);
case 95:
if (
- ((this.isPreview = !!Y.__N_PREVIEW),
- Y.notFound !== T)
+ ((this.isPreview = !!Q.__N_PREVIEW),
+ Q.notFound !== A)
) {
e.next = 109;
break;
@@ -1310,59 +1332,59 @@
this.fetchComponent("/404")
);
case 100:
- (ot = "/404"), (e.next = 106);
+ (at = "/404"), (e.next = 106);
break;
case 103:
(e.prev = 103),
(e.t1 = e.catch(97)),
- (ot = "/_error");
+ (at = "/_error");
case 106:
return (
(e.next = 108),
- this.getRouteInfo(ot, ot, j, a, N, {
+ this.getRouteInfo(at, at, I, a, U, {
shallow: !1
})
);
case 108:
- z = e.sent;
+ J = e.sent;
case 109:
return (
- t.events.emit("beforeHistoryChange", a, g),
+ t.events.emit("beforeHistoryChange", a, y),
this.changeState(r, o, a, i),
- (at = i.shallow && this.route === M),
+ (it = i.shallow && this.route === N),
i._h &&
"/_error" === O &&
500 ===
- (null == (V = self.__NEXT_DATA__.props) ||
- null == (X = V.pageProps)
+ (null == (X = self.__NEXT_DATA__.props) ||
+ null == (z = X.pageProps)
? void 0
- : X.statusCode) &&
- null != Y &&
- Y.pageProps &&
- (Y.pageProps.statusCode = 500),
+ : z.statusCode) &&
+ null != Q &&
+ Q.pageProps &&
+ (Q.pageProps.statusCode = 500),
(e.next = 116),
this.set(
- M,
+ N,
O,
- j,
+ I,
w,
- z,
- u || (at || !i.scroll ? null : { x: 0, y: 0 })
+ J,
+ u || (it || !i.scroll ? null : { x: 0, y: 0 })
).catch(function(t) {
if (!t.cancelled) throw t;
- $ = $ || t;
+ Y = Y || t;
})
);
case 116:
- if (!$) {
+ if (!Y) {
e.next = 119;
break;
}
- throw (t.events.emit("routeChangeError", $, w, g),
- $);
+ throw (t.events.emit("routeChangeError", Y, w, y),
+ Y);
case 119:
return (
- t.events.emit("routeChangeComplete", a, g),
+ t.events.emit("routeChangeComplete", a, y),
e.abrupt("return", !0)
);
case 124:
@@ -1443,7 +1465,7 @@
}
throw (t.events.emit("routeChangeError", r, i, u),
(window.location.href = i),
- w());
+ b());
case 6:
if (
((e.prev = 6),
@@ -1696,32 +1718,6 @@
return this.asPath !== t;
}
},
- {
- key: "_resolveHref",
- value: function(t, e) {
- var r =
- !(arguments.length > 2 && void 0 !== arguments[2]) ||
- arguments[2],
- n = t.pathname,
- o = (0, s.removePathTrailingSlash)(
- (0, l.denormalizePagePath)(r ? S(n) : n)
- );
- return (
- "/404" === o ||
- "/_error" === o ||
- (e.includes(o) ||
- e.some(function(e) {
- if (
- (0, p.isDynamicRoute)(e) &&
- (0, m.getRouteRegex)(e).re.test(o)
- )
- return (t.pathname = r ? k(e) : e), !0;
- }),
- (t.pathname = (0, s.removePathTrailingSlash)(t.pathname))),
- t
- );
- }
- },
{
key: "prefetch",
value: (function() {
@@ -1733,8 +1729,12 @@
i,
u,
c,
- l = this,
- f = arguments;
+ l,
+ f,
+ p,
+ v,
+ m = this,
+ g = arguments;
return n.wrap(
function(t) {
for (;;)
@@ -1742,9 +1742,9 @@
case 0:
return (
(r =
- f.length > 1 && void 0 !== f[1] ? f[1] : e),
+ g.length > 1 && void 0 !== g[1] ? g[1] : e),
(o =
- f.length > 2 && void 0 !== f[2] ? f[2] : {}),
+ g.length > 2 && void 0 !== g[2] ? g[2] : {}),
(a = (0, d.parseRelativeUrl)(e)),
(i = a.pathname),
(t.next = 7),
@@ -1752,28 +1752,50 @@
);
case 7:
(u = t.sent),
- (a = this._resolveHref(a, u, !1)).pathname !==
- i &&
+ (a = j(a, u, !1)).pathname !== i &&
((i = a.pathname),
(e = (0, h.formatWithValidation)(a))),
- (t.next = 12);
+ (c = (0, s.removePathTrailingSlash)(i)),
+ (l = r),
+ (t.next = 19);
break;
- case 12:
+ case 15:
+ (p = t.sent),
+ (f = p.__rewrites),
+ (v = (0, y.default)(
+ S(_(E(r), this.locale)),
+ u,
+ f,
+ a.query,
+ function(t) {
+ return j({ pathname: t }, u).pathname;
+ },
+ this.locales
+ )).matchedPage &&
+ v.resolvedHref &&
+ ((c = v.resolvedHref),
+ (i = v.resolvedHref),
+ (a.pathname = i),
+ (e = (0, h.formatWithValidation)(a)),
+ (l = v.asPath));
+ case 19:
+ t.next = 21;
+ break;
+ case 21:
return (
- (c = (0, s.removePathTrailingSlash)(i)),
- (t.next = 15),
+ (t.next = 23),
Promise.all([
this.pageLoader._isSsg(e).then(function(t) {
return (
!!t &&
- l._getStaticData(
- l.pageLoader.getDataHref(
+ m._getStaticData(
+ m.pageLoader.getDataHref(
e,
- r,
+ l,
!0,
"undefined" !== typeof o.locale
? o.locale
- : l.locale
+ : m.locale
)
)
);
@@ -1783,7 +1805,7 @@
](c)
])
);
- case 15:
+ case 23:
case "end":
return t.stop();
}
@@ -1876,7 +1898,7 @@
r = new URL(t, window.location.href).href;
return !this.isPreview && this.sdc[r]
? Promise.resolve(this.sdc[r])
- : A(t, this.isSsr).then(function(t) {
+ : M(t, this.isSsr).then(function(t) {
return (e.sdc[r] = t), t;
});
}
@@ -1884,7 +1906,7 @@
{
key: "_getServerData",
value: function(t) {
- return A(t, this.isSsr);
+ return M(t, this.isSsr);
}
},
{
@@ -1907,7 +1929,7 @@
key: "abortComponentLoad",
value: function(e, r) {
this.clc &&
- (t.events.emit("routeChangeError", w(), e, r),
+ (t.events.emit("routeChangeError", b(), e, r),
this.clc(),
(this.clc = null));
}
@@ -1922,7 +1944,7 @@
t
);
})();
- (e.default = D), (D.events = (0, f.default)());
+ (e.default = N), (N.events = (0, f.default)());
},
"g/15": function(t, e, r) {
"use strict";
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/",
"query": {},
- "buildId": "0IF23XFb8bBeATZD_892O",
+ "buildId": "-6MjL428PIrTf270BP1cC",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/0IF23XFb8bBeATZD_892O/_buildManifest.js"
+ src="/_next/static/-6MjL428PIrTf270BP1cC/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/0IF23XFb8bBeATZD_892O/_ssgManifest.js"
+ src="/_next/static/-6MjL428PIrTf270BP1cC/_ssgManifest.js"
async=""
></script>
</body>
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -48,7 +48,7 @@
"props": { "pageProps": {} },
"page": "/link",
"query": {},
- "buildId": "0IF23XFb8bBeATZD_892O",
+ "buildId": "-6MjL428PIrTf270BP1cC",
"isFallback": false,
"gip": true
}
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -82,11 +82,11 @@
async=""
></script>
<script
- src="/_next/static/0IF23XFb8bBeATZD_892O/_buildManifest.js"
+ src="/_next/static/-6MjL428PIrTf270BP1cC/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/0IF23XFb8bBeATZD_892O/_ssgManifest.js"
+ src="/_next/static/-6MjL428PIrTf270BP1cC/_ssgManifest.js"
async=""
></script>
</body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/withRouter",
"query": {},
- "buildId": "0IF23XFb8bBeATZD_892O",
+ "buildId": "-6MjL428PIrTf270BP1cC",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/0IF23XFb8bBeATZD_892O/_buildManifest.js"
+ src="/_next/static/-6MjL428PIrTf270BP1cC/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/0IF23XFb8bBeATZD_892O/_ssgManifest.js"
+ src="/_next/static/-6MjL428PIrTf270BP1cC/_ssgManifest.js"
async=""
></script>
</body>
Timer
approved these changes
Feb 24, 2021
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 11.3s | 11.4s | |
nodeModulesSize | 42.7 MB | 42.7 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.991 | 2.091 | |
/ avg req/sec | 1255.42 | 1195.59 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.308 | 1.34 | |
/error-in-render avg req/sec | 1910.82 | 1866.03 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..db13.js gzip | 13.3 kB | 13.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 614 B | 612 B | -2 B |
link.html gzip | 619 B | 619 B | ✓ |
withRouter.html gzip | 608 B | 607 B | -1 B |
Overall change | 1.84 kB | 1.84 kB | -3 B |
Diffs
Diff for 677f882d2ed8..2f1e56545.js
@@ -1492,6 +1492,41 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
};
}
+ function resolveDynamicRoute(parsedHref, pages) {
+ var applyBasePath =
+ arguments.length > 2 && arguments[2] !== undefined
+ ? arguments[2]
+ : true;
+ var pathname = parsedHref.pathname;
+ var cleanPathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(
+ (0, _denormalizePagePath.denormalizePagePath)(
+ applyBasePath ? delBasePath(pathname) : pathname
+ )
+ );
+
+ if (cleanPathname === "/404" || cleanPathname === "/_error") {
+ return parsedHref;
+ } // handle resolving href for dynamic routes
+
+ if (!pages.includes(cleanPathname)) {
+ // eslint-disable-next-line array-callback-return
+ pages.some(function(page) {
+ if (
+ (0, _isDynamic.isDynamicRoute)(page) &&
+ (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
+ ) {
+ parsedHref.pathname = applyBasePath ? addBasePath(page) : page;
+ return true;
+ }
+ });
+ }
+
+ parsedHref.pathname = (0,
+ _normalizeTrailingSlash.removePathTrailingSlash)(parsedHref.pathname);
+ return parsedHref;
+ }
+
var manualScrollRestoration = false && false;
var SSG_DATA_NOT_FOUND = Symbol("SSG_DATA_NOT_FOUND");
@@ -1827,8 +1862,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
options,
forcedScroll
) {
- var _this2 = this;
-
var _options$scroll,
localeChange,
parsedAs,
@@ -2066,7 +2099,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
return _context.abrupt("return", false);
case 50:
- parsed = this._resolveHref(parsed, pages);
+ parsed = resolveDynamicRoute(parsed, pages);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
@@ -2265,8 +2298,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
parsedHref = (0,
_parseRelativeUrl.parseRelativeUrl)(destination);
-
- this._resolveHref(parsedHref, pages, false);
+ resolveDynamicRoute(parsedHref, pages, false);
if (!pages.includes(parsedHref.pathname)) {
_context.next = 93;
@@ -2641,7 +2673,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
resolvedAs,
routeProps
) {
- var _this3 = this;
+ var _this2 = this;
var existingRouteInfo,
cachedRouteInfo,
@@ -2761,10 +2793,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_context3.next = 21;
return this._getData(function() {
return __N_SSG
- ? _this3._getStaticData(dataHref)
+ ? _this2._getStaticData(dataHref)
: __N_SSP
- ? _this3._getServerData(dataHref)
- : _this3.getInitialProps(
+ ? _this2._getServerData(dataHref)
+ : _this2.getInitialProps(
Component, // we provide AppTree later so this needs to be `any`
{
pathname: pathname,
@@ -2901,47 +2933,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: function urlIsNew(asPath) {
return this.asPath !== asPath;
}
- },
- {
- key: "_resolveHref",
- value: function _resolveHref(parsedHref, pages) {
- var applyBasePath =
- arguments.length > 2 && arguments[2] !== undefined
- ? arguments[2]
- : true;
- var pathname = parsedHref.pathname;
- var cleanPathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- (0, _denormalizePagePath.denormalizePagePath)(
- applyBasePath ? delBasePath(pathname) : pathname
- )
- );
-
- if (cleanPathname === "/404" || cleanPathname === "/_error") {
- return parsedHref;
- } // handle resolving href for dynamic routes
-
- if (!pages.includes(cleanPathname)) {
- // eslint-disable-next-line array-callback-return
- pages.some(function(page) {
- if (
- (0, _isDynamic.isDynamicRoute)(page) &&
- (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
- ) {
- parsedHref.pathname = applyBasePath
- ? addBasePath(page)
- : page;
- return true;
- }
- });
- }
-
- parsedHref.pathname = (0,
- _normalizeTrailingSlash.removePathTrailingSlash)(
- parsedHref.pathname
- );
- return parsedHref;
- }
/**
* Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
@@ -2954,7 +2945,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
value: (function() {
var _prefetch = _asyncToGenerator(
/*#__PURE__*/ _regeneratorRuntime.mark(function _callee4(url) {
- var _this4 = this;
+ var _this3 = this;
var asPath,
options,
@@ -2965,6 +2956,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
localePathResult,
pages,
route,
+ resolvedAs,
+ rewrites,
+ _yield2,
+ rewritesResult,
_args4 = arguments;
return _regeneratorRuntime.wrap(
@@ -2993,37 +2988,82 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 7:
pages = _context4.sent;
- parsed = this._resolveHref(parsed, pages, false);
+ parsed = resolveDynamicRoute(parsed, pages, false);
if (parsed.pathname !== pathname) {
pathname = parsed.pathname;
url = (0, _utils.formatWithValidation)(parsed);
- } // Prefetch is not supported in development mode because it would trigger on-demand-entries
-
- if (true) {
- _context4.next = 12;
- break;
}
- return _context4.abrupt("return");
-
- case 12:
route = (0,
_normalizeTrailingSlash.removePathTrailingSlash)(
pathname
);
+ resolvedAs = asPath;
+
+ if (true) {
+ _context4.next = 19;
+ break;
+ }
+
_context4.next = 15;
+ return (0, _routeLoader.getClientBuildManifest)();
+
+ case 15:
+ _yield2 = _context4.sent;
+ rewrites = _yield2.__rewrites;
+ rewritesResult = (0, _resolveRewrites["default"])(
+ addBasePath(
+ addLocale(delBasePath(asPath), this.locale)
+ ),
+ pages,
+ rewrites,
+ parsed.query,
+ function(p) {
+ return resolveDynamicRoute(
+ {
+ pathname: p
+ },
+ pages
+ ).pathname;
+ },
+ this.locales
+ );
+
+ if (
+ rewritesResult.matchedPage &&
+ rewritesResult.resolvedHref
+ ) {
+ // if this directly matches a page we need to update the href to
+ // allow the correct page chunk to be loaded
+ route = rewritesResult.resolvedHref;
+ pathname = rewritesResult.resolvedHref;
+ parsed.pathname = pathname;
+ url = (0, _utils.formatWithValidation)(parsed);
+ resolvedAs = rewritesResult.asPath;
+ }
+
+ case 19:
+ if (true) {
+ _context4.next = 21;
+ break;
+ }
+
+ return _context4.abrupt("return");
+
+ case 21:
+ _context4.next = 23;
return Promise.all([
this.pageLoader._isSsg(url).then(function(isSsg) {
return isSsg
- ? _this4._getStaticData(
- _this4.pageLoader.getDataHref(
+ ? _this3._getStaticData(
+ _this3.pageLoader.getDataHref(
url,
- asPath,
+ resolvedAs,
true,
typeof options.locale !== "undefined"
? options.locale
- : _this4.locale
+ : _this3.locale
)
)
: false;
@@ -3033,7 +3073,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
](route)
]);
- case 15:
+ case 23:
case "end":
return _context4.stop();
}
@@ -3120,7 +3160,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getData",
value: function _getData(fn) {
- var _this5 = this;
+ var _this4 = this;
var cancelled = false;
@@ -3130,8 +3170,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
this.clc = cancel;
return fn().then(function(data) {
- if (cancel === _this5.clc) {
- _this5.clc = null;
+ if (cancel === _this4.clc) {
+ _this4.clc = null;
}
if (cancelled) {
@@ -3147,7 +3187,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
{
key: "_getStaticData",
value: function _getStaticData(dataHref) {
- var _this6 = this;
+ var _this5 = this;
var _URL = new URL(dataHref, window.location.href),
cacheKey = _URL.href;
@@ -3157,7 +3197,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
return fetchNextData(dataHref, this.isSsr).then(function(data) {
- _this6.sdc[cacheKey] = data;
+ _this5.sdc[cacheKey] = data;
return data;
});
}
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
as="script"
/>
<link
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b7aab3fe2ab2f1e56545.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
async=""
></script>
<script
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.6s | -34ms |
nodeModulesSize | 42.7 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
677f882d2ed8..db13.js gzip | 13.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-HASH.js gzip | 6.65 kB | 6.65 kB | ✓ |
webpack-HASH.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..e7a0.js gzip | N/A | 13.4 kB | N/A |
Overall change | 59.6 kB | 59.7 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.3 kB | 31.3 kB | ✓ |
Overall change | 31.3 kB | 31.3 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-2a09aa2..4a98.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-8b758..aef6.js gzip | 3.46 kB | 3.46 kB | ✓ |
amp-e3e9bc99..932c.js gzip | 536 B | 536 B | ✓ |
hooks-5023ef..3670.js gzip | 888 B | 888 B | ✓ |
index-3a2b03..c677.js gzip | 227 B | 227 B | ✓ |
link-177412b..043e.js gzip | 1.67 kB | 1.67 kB | ✓ |
routerDirect..1a66.js gzip | 303 B | 303 B | ✓ |
withRouter-9..1b7d.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.66 kB | 8.66 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 347 B | 347 B | ✓ |
Overall change | 347 B | 347 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_error.js | 1.01 MB | 1.01 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
500.html | 2.65 kB | 2.65 kB | ✓ |
amp.amp.html | 10.4 kB | 10.4 kB | ✓ |
amp.html | 1.86 kB | 1.86 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1.01 MB | 1.01 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.06 MB | 1.06 MB | |
withRouter.js | 1.06 MB | 1.06 MB | |
Overall change | 5.21 MB | 5.21 MB |
Webpack 5 Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.6s | |
nodeModulesSize | 42.7 MB | 42.7 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.015 | 2.171 | |
/ avg req/sec | 1240.45 | 1151.79 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.263 | 1.324 | |
/error-in-render avg req/sec | 1978.63 | 1888.52 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
597-3917a1f0..7bfd.js gzip | 13.2 kB | 13.3 kB | |
framework.HASH.js gzip | 39.3 kB | 39.3 kB | ✓ |
main-HASH.js gzip | 6.59 kB | 6.59 kB | ✓ |
webpack-HASH.js gzip | 954 B | 954 B | ✓ |
Overall change | 60 kB | 60.1 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31.1 kB | 31.1 kB | ✓ |
Overall change | 31.1 kB | 31.1 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_app-aedc815..1421.js gzip | 1.26 kB | 1.26 kB | ✓ |
_error-71ec2..1a96.js gzip | 3.38 kB | 3.38 kB | ✓ |
amp-33a09cb0..6745.js gzip | 536 B | 536 B | ✓ |
hooks-4e968a..f870.js gzip | 902 B | 902 B | ✓ |
index-5c6845..f75c.js gzip | 230 B | 230 B | ✓ |
link-99f0c6c..b84a.js gzip | 1.65 kB | 1.65 kB | ✓ |
routerDirect..bb56.js gzip | 306 B | 306 B | ✓ |
withRouter-7..2133.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.57 kB | 8.57 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
_buildManifest.js gzip | 326 B | 326 B | ✓ |
Overall change | 326 B | 326 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js fix/rewrite-prefetching | Change | |
---|---|---|---|
index.html gzip | 586 B | 587 B | |
link.html gzip | 592 B | 593 B | |
withRouter.html gzip | 581 B | 581 B | ✓ |
Overall change | 1.76 kB | 1.76 kB |
Diffs
Diff for 677f882d2ed8..7d7a7db13.js
@@ -719,74 +719,75 @@
0;
return !1;
}),
- (e.addLocale = b),
- (e.delLocale = _),
- (e.hasBasePath = P),
- (e.addBasePath = k),
- (e.delBasePath = S),
- (e.isLocalURL = E),
- (e.interpolateAs = R),
- (e.resolveHref = C),
+ (e.addLocale = _),
+ (e.delLocale = x),
+ (e.hasBasePath = k),
+ (e.addBasePath = S),
+ (e.delBasePath = E),
+ (e.isLocalURL = R),
+ (e.interpolateAs = L),
+ (e.resolveHref = O),
(e.default = void 0);
var s = r("X24+"),
c = r("Nh2W"),
l = r("wkBG"),
- f = (r("3wub"), g(r("dZ6Y"))),
+ f = (r("3wub"), w(r("dZ6Y"))),
h = r("g/15"),
p = r("/jkW"),
d = r("hS4m"),
v = r("3WeD"),
- y = (g(r("GXs3")), r("gguc")),
- m = r("YTqd");
- function g(t) {
+ y = w(r("GXs3")),
+ m = r("gguc"),
+ g = r("YTqd");
+ function w(t) {
return t && t.__esModule ? t : { default: t };
}
- function w() {
+ function b() {
return Object.assign(new Error("Route Cancelled"), { cancelled: !0 });
}
- function b(t, e, r) {
+ function _(t, e, r) {
return t;
}
- function _(t, e) {
+ function x(t, e) {
return t;
}
- function x(t) {
+ function P(t) {
var e = t.indexOf("?"),
r = t.indexOf("#");
return (e > -1 || r > -1) && (t = t.substring(0, e > -1 ? e : r)), t;
}
- function P(t) {
- return "" === (t = x(t)) || t.startsWith("/");
- }
function k(t) {
+ return "" === (t = P(t)) || t.startsWith("/");
+ }
+ function S(t) {
return (function(t, e) {
return e && t.startsWith("/")
? "/" === t
? (0, s.normalizePathTrailingSlash)(e)
- : "".concat(e).concat("/" === x(t) ? t.substring(1) : t)
+ : "".concat(e).concat("/" === P(t) ? t.substring(1) : t)
: t;
})(t, "");
}
- function S(t) {
+ function E(t) {
return (
(t = t.slice("".length)).startsWith("/") || (t = "/".concat(t)), t
);
}
- function E(t) {
+ function R(t) {
if (t.startsWith("/") || t.startsWith("#")) return !0;
try {
var e = (0, h.getLocationOrigin)(),
r = new URL(t, e);
- return r.origin === e && P(r.pathname);
+ return r.origin === e && k(r.pathname);
} catch (n) {
return !1;
}
}
- function R(t, e, r) {
+ function L(t, e, r) {
var n = "",
- o = (0, m.getRouteRegex)(t),
+ o = (0, g.getRouteRegex)(t),
a = o.groups,
- i = (e !== t ? (0, y.getRouteMatcher)(o)(e) : "") || r;
+ i = (e !== t ? (0, m.getRouteMatcher)(o)(e) : "") || r;
n = t;
var u = Object.keys(a);
return (
@@ -816,7 +817,7 @@
{ params: u, result: n }
);
}
- function L(t, e) {
+ function C(t, e) {
var r = {};
return (
Object.keys(t).forEach(function(n) {
@@ -825,24 +826,24 @@
r
);
}
- function C(t, e, r) {
+ function O(t, e, r) {
var n = new URL(t, "http://n"),
o = "string" === typeof e ? e : (0, h.formatWithValidation)(e);
- if (!E(o)) return r ? [o] : o;
+ if (!R(o)) return r ? [o] : o;
try {
var a = new URL(o, n);
a.pathname = (0, s.normalizePathTrailingSlash)(a.pathname);
var i = "";
if ((0, p.isDynamicRoute)(a.pathname) && a.searchParams && r) {
var u = (0, v.searchParamsToUrlQuery)(a.searchParams),
- c = R(a.pathname, a.pathname, u),
+ c = L(a.pathname, a.pathname, u),
l = c.result,
f = c.params;
l &&
(i = (0, h.formatWithValidation)({
pathname: l,
hash: a.hash,
- query: L(u, f)
+ query: C(u, f)
}));
}
var d =
@@ -852,31 +853,53 @@
return r ? [o] : o;
}
}
- function O(t) {
+ function I(t) {
var e = (0, h.getLocationOrigin)();
return t.startsWith(e) ? t.substring(e.length) : t;
}
- function I(t, e, r) {
- var n = C(t.pathname, e, !0),
+ function T(t, e, r) {
+ var n = O(t.pathname, e, !0),
o = u(n, 2),
a = o[0],
i = o[1],
s = (0, h.getLocationOrigin)(),
c = a.startsWith(s),
l = i && i.startsWith(s);
- (a = O(a)), (i = i ? O(i) : i);
- var f = c ? a : k(a),
- p = r ? O(C(t.pathname, r)) : i || a;
- return { url: f, as: l ? p : k(p) };
+ (a = I(a)), (i = i ? I(i) : i);
+ var f = c ? a : S(a),
+ p = r ? I(O(t.pathname, r)) : i || a;
+ return { url: f, as: l ? p : S(p) };
}
- var T = Symbol("SSG_DATA_NOT_FOUND");
function j(t, e) {
+ var r =
+ !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2],
+ n = t.pathname,
+ o = (0, s.removePathTrailingSlash)(
+ (0, l.denormalizePagePath)(r ? E(n) : n)
+ );
+ return (
+ "/404" === o ||
+ "/_error" === o ||
+ (e.includes(o) ||
+ e.some(function(e) {
+ if (
+ (0, p.isDynamicRoute)(e) &&
+ (0, g.getRouteRegex)(e).re.test(o)
+ )
+ return (t.pathname = r ? S(e) : e), !0;
+ }),
+ (t.pathname = (0, s.removePathTrailingSlash)(t.pathname))),
+ t
+ );
+ }
+ var A = Symbol("SSG_DATA_NOT_FOUND");
+ function D(t, e) {
return fetch(t, { credentials: "same-origin" }).then(function(r) {
if (!r.ok) {
- if (e > 1 && r.status >= 500) return j(t, e - 1);
+ if (e > 1 && r.status >= 500) return D(t, e - 1);
if (404 === r.status)
return r.json().then(function(t) {
- if (t.notFound) return { notFound: T };
+ if (t.notFound) return { notFound: A };
throw new Error("Failed to load static props");
});
throw new Error("Failed to load static props");
@@ -884,12 +907,12 @@
return r.json();
});
}
- function A(t, e) {
- return j(t, e ? 3 : 1).catch(function(t) {
+ function M(t, e) {
+ return D(t, e ? 3 : 1).catch(function(t) {
throw (e || (0, c.markAssetError)(t), t);
});
}
- var D = (function() {
+ var N = (function() {
function t(e, r, n, o) {
var i = this,
u = o.initialProps,
@@ -956,7 +979,7 @@
c = i.query;
i.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(s), query: c }),
+ (0, h.formatWithValidation)({ pathname: S(s), query: c }),
(0, h.getURL)()
);
}
@@ -995,7 +1018,7 @@
"//" !== n.substr(0, 2) &&
this.changeState(
"replaceState",
- (0, h.formatWithValidation)({ pathname: k(e), query: r }),
+ (0, h.formatWithValidation)({ pathname: S(e), query: r }),
(0, h.getURL)(),
{ locale: w }
),
@@ -1022,7 +1045,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {};
- var n = I(this, t, e);
+ var n = T(this, t, e);
return (
(t = n.url), (e = n.as), this.change("pushState", t, e, r)
);
@@ -1035,7 +1058,7 @@
arguments.length > 2 && void 0 !== arguments[2]
? arguments[2]
: {},
- n = I(this, t, e);
+ n = T(this, t, e);
return (
(t = n.url), (e = n.as), this.change("replaceState", t, e, r)
);
@@ -1049,13 +1072,12 @@
var l,
f,
v,
- g,
+ y,
w,
- x,
- C,
+ b,
+ P,
O,
- j,
- A,
+ I,
D,
M,
N,
@@ -1065,8 +1087,8 @@
F,
G,
B,
- H,
V,
+ H,
X,
z,
J,
@@ -1080,13 +1102,14 @@
rt,
nt,
ot,
- at;
+ at,
+ it;
return n.wrap(
function(e) {
for (;;)
switch ((e.prev = e.next)) {
case 0:
- if (E(o)) {
+ if (R(o)) {
e.next = 3;
break;
}
@@ -1105,20 +1128,20 @@
(i._h || (this.isSsr = !1),
h.ST && performance.mark("routeChange"),
(v = i.shallow),
- (g = { shallow: void 0 !== v && v }),
+ (y = { shallow: void 0 !== v && v }),
this._inFlightRoute &&
this.abortComponentLoad(
this._inFlightRoute,
- g
+ y
),
- (a = k(
- b(
- P(a) ? S(a) : a,
+ (a = S(
+ _(
+ k(a) ? E(a) : a,
i.locale,
this.defaultLocale
)
)),
- (w = _(P(a) ? S(a) : a, this.locale)),
+ (w = x(k(a) ? E(a) : a, this.locale)),
(this._inFlightRoute = a),
i._h || !this.onlyAHashChange(w))
) {
@@ -1127,30 +1150,30 @@
}
return (
(this.asPath = w),
- t.events.emit("hashChangeStart", a, g),
+ t.events.emit("hashChangeStart", a, y),
this.changeState(r, o, a, i),
this.scrollToHash(w),
this.notify(this.components[this.route], null),
- t.events.emit("hashChangeComplete", a, g),
+ t.events.emit("hashChangeComplete", a, y),
e.abrupt("return", !0)
);
case 34:
return (
- (x = (0, d.parseRelativeUrl)(o)),
- (O = (C = x).pathname),
- (j = C.query),
+ (b = (0, d.parseRelativeUrl)(o)),
+ (O = (P = b).pathname),
+ (I = P.query),
(e.prev = 36),
(e.next = 39),
this.pageLoader.getPageList()
);
case 39:
return (
- (A = e.sent),
+ (D = e.sent),
(e.next = 42),
(0, c.getClientBuildManifest)()
);
case 42:
- (D = e.sent), D.__rewrites, (e.next = 50);
+ (M = e.sent), M.__rewrites, (e.next = 50);
break;
case 46:
return (
@@ -1161,16 +1184,16 @@
);
case 50:
if (
- ((x = this._resolveHref(x, A)).pathname !== O &&
- ((O = x.pathname),
- (o = (0, h.formatWithValidation)(x))),
+ ((b = j(b, D)).pathname !== O &&
+ ((O = b.pathname),
+ (o = (0, h.formatWithValidation)(b))),
(O = O
- ? (0, s.removePathTrailingSlash)(S(O))
+ ? (0, s.removePathTrailingSlash)(E(O))
: O),
this.urlIsNew(w) || f || (r = "replaceState"),
- (M = (0, s.removePathTrailingSlash)(O)),
- (N = a),
- E(a))
+ (N = (0, s.removePathTrailingSlash)(O)),
+ (U = a),
+ R(a))
) {
e.next = 62;
break;
@@ -1184,29 +1207,29 @@
);
case 62:
if (
- ((N = _(S(N), this.locale)),
- !(0, p.isDynamicRoute)(M))
+ ((U = x(E(U), this.locale)),
+ !(0, p.isDynamicRoute)(N))
) {
e.next = 78;
break;
}
if (
- ((U = (0, d.parseRelativeUrl)(N)),
- (W = U.pathname),
- (q = (0, m.getRouteRegex)(M)),
- (F = (0, y.getRouteMatcher)(q)(W)),
- (B = (G = M === W) ? R(M, W, j) : {}),
- F && (!G || B.result))
+ ((W = (0, d.parseRelativeUrl)(U)),
+ (q = W.pathname),
+ (F = (0, g.getRouteRegex)(N)),
+ (G = (0, m.getRouteMatcher)(F)(q)),
+ (V = (B = N === q) ? L(N, q, I) : {}),
+ G && (!B || V.result))
) {
e.next = 77;
break;
}
if (
!(
- (H = Object.keys(q.groups).filter(function(
+ (H = Object.keys(F.groups).filter(function(
t
) {
- return !j[t];
+ return !I[t];
})).length > 0
)
) {
@@ -1214,7 +1237,7 @@
break;
}
throw new Error(
- (G
+ (B
? "The provided `href` ("
.concat(
o,
@@ -1226,12 +1249,12 @@
)
: "The provided `as` value ("
.concat(
- W,
+ q,
") is incompatible with the `href` value ("
)
- .concat(M, "). ")) +
+ .concat(N, "). ")) +
"Read more: https://err.sh/vercel/next.js/".concat(
- G
+ B
? "href-interpolation-failed"
: "incompatible-href-as"
)
@@ -1240,66 +1263,65 @@
e.next = 78;
break;
case 77:
- G
+ B
? (a = (0, h.formatWithValidation)(
- Object.assign({}, U, {
- pathname: B.result,
- query: L(j, B.params)
+ Object.assign({}, W, {
+ pathname: V.result,
+ query: C(I, V.params)
})
))
- : Object.assign(j, F);
+ : Object.assign(I, G);
case 78:
return (
- t.events.emit("routeChangeStart", a, g),
+ t.events.emit("routeChangeStart", a, y),
(e.prev = 79),
(e.next = 82),
- this.getRouteInfo(M, O, j, a, N, g)
+ this.getRouteInfo(N, O, I, a, U, y)
);
case 82:
if (
- ((z = e.sent),
- ($ = (J = z).error),
- (Y = J.props),
- (Q = J.__N_SSG),
- (Z = J.__N_SSP),
- (!Q && !Z) || !Y)
+ ((J = e.sent),
+ (Y = ($ = J).error),
+ (Q = $.props),
+ (Z = $.__N_SSG),
+ (K = $.__N_SSP),
+ (!Z && !K) || !Q)
) {
e.next = 109;
break;
}
- if (!Y.pageProps || !Y.pageProps.__N_REDIRECT) {
+ if (!Q.pageProps || !Q.pageProps.__N_REDIRECT) {
e.next = 95;
break;
}
if (
- !(K = Y.pageProps.__N_REDIRECT).startsWith("/")
+ !(tt = Q.pageProps.__N_REDIRECT).startsWith("/")
) {
e.next = 93;
break;
}
if (
- ((tt = (0, d.parseRelativeUrl)(K)),
- this._resolveHref(tt, A, !1),
- !A.includes(tt.pathname))
+ (j((et = (0, d.parseRelativeUrl)(tt)), D, !1),
+ !D.includes(et.pathname))
) {
e.next = 93;
break;
}
return (
- (et = I(this, K, K)),
- (rt = et.url),
- (nt = et.as),
- e.abrupt("return", this.change(r, rt, nt, i))
+ (rt = T(this, tt, tt)),
+ (nt = rt.url),
+ (ot = rt.as),
+ e.abrupt("return", this.change(r, nt, ot, i))
);
case 93:
return (
- (window.location.href = K),
+ (window.location.href = tt),
e.abrupt("return", new Promise(function() {}))
);
case 95:
if (
- ((this.isPreview = !!Y.__N_PREVIEW),
- Y.notFound !== T)
+ ((this.isPreview = !!Q.__N_PREVIEW),
+ Q.notFound !== A)
) {
e.next = 109;
break;
@@ -1310,59 +1332,59 @@
this.fetchComponent("/404")
);
case 100:
- (ot = "/404"), (e.next = 106);
+ (at = "/404"), (e.next = 106);
break;
case 103:
(e.prev = 103),
(e.t1 = e.catch(97)),
- (ot = "/_error");
+ (at = "/_error");
case 106:
return (
(e.next = 108),
- this.getRouteInfo(ot, ot, j, a, N, {
+ this.getRouteInfo(at, at, I, a, U, {
shallow: !1
})
);
case 108:
- z = e.sent;
+ J = e.sent;
case 109:
return (
- t.events.emit("beforeHistoryChange", a, g),
+ t.events.emit("beforeHistoryChange", a, y),
this.changeState(r, o, a, i),
- (at = i.shallow && this.route === M),
+ (it = i.shallow && this.route === N),
i._h &&
"/_error" === O &&
500 ===
- (null == (V = self.__NEXT_DATA__.props) ||
- null == (X = V.pageProps)
+ (null == (X = self.__NEXT_DATA__.props) ||
+ null == (z = X.pageProps)
? void 0
- : X.statusCode) &&
- null != Y &&
- Y.pageProps &&
- (Y.pageProps.statusCode = 500),
+ : z.statusCode) &&
+ null != Q &&
+ Q.pageProps &&
+ (Q.pageProps.statusCode = 500),
(e.next = 116),
this.set(
- M,
+ N,
O,
- j,
+ I,
w,
- z,
- u || (at || !i.scroll ? null : { x: 0, y: 0 })
+ J,
+ u || (it || !i.scroll ? null : { x: 0, y: 0 })
).catch(function(t) {
if (!t.cancelled) throw t;
- $ = $ || t;
+ Y = Y || t;
})
);
case 116:
- if (!$) {
+ if (!Y) {
e.next = 119;
break;
}
- throw (t.events.emit("routeChangeError", $, w, g),
- $);
+ throw (t.events.emit("routeChangeError", Y, w, y),
+ Y);
case 119:
return (
- t.events.emit("routeChangeComplete", a, g),
+ t.events.emit("routeChangeComplete", a, y),
e.abrupt("return", !0)
);
case 124:
@@ -1443,7 +1465,7 @@
}
throw (t.events.emit("routeChangeError", r, i, u),
(window.location.href = i),
- w());
+ b());
case 6:
if (
((e.prev = 6),
@@ -1696,32 +1718,6 @@
return this.asPath !== t;
}
},
- {
- key: "_resolveHref",
- value: function(t, e) {
- var r =
- !(arguments.length > 2 && void 0 !== arguments[2]) ||
- arguments[2],
- n = t.pathname,
- o = (0, s.removePathTrailingSlash)(
- (0, l.denormalizePagePath)(r ? S(n) : n)
- );
- return (
- "/404" === o ||
- "/_error" === o ||
- (e.includes(o) ||
- e.some(function(e) {
- if (
- (0, p.isDynamicRoute)(e) &&
- (0, m.getRouteRegex)(e).re.test(o)
- )
- return (t.pathname = r ? k(e) : e), !0;
- }),
- (t.pathname = (0, s.removePathTrailingSlash)(t.pathname))),
- t
- );
- }
- },
{
key: "prefetch",
value: (function() {
@@ -1733,8 +1729,12 @@
i,
u,
c,
- l = this,
- f = arguments;
+ l,
+ f,
+ p,
+ v,
+ m = this,
+ g = arguments;
return n.wrap(
function(t) {
for (;;)
@@ -1742,9 +1742,9 @@
case 0:
return (
(r =
- f.length > 1 && void 0 !== f[1] ? f[1] : e),
+ g.length > 1 && void 0 !== g[1] ? g[1] : e),
(o =
- f.length > 2 && void 0 !== f[2] ? f[2] : {}),
+ g.length > 2 && void 0 !== g[2] ? g[2] : {}),
(a = (0, d.parseRelativeUrl)(e)),
(i = a.pathname),
(t.next = 7),
@@ -1752,28 +1752,50 @@
);
case 7:
(u = t.sent),
- (a = this._resolveHref(a, u, !1)).pathname !==
- i &&
+ (a = j(a, u, !1)).pathname !== i &&
((i = a.pathname),
(e = (0, h.formatWithValidation)(a))),
- (t.next = 12);
+ (c = (0, s.removePathTrailingSlash)(i)),
+ (l = r),
+ (t.next = 19);
break;
- case 12:
+ case 15:
+ (p = t.sent),
+ (f = p.__rewrites),
+ (v = (0, y.default)(
+ S(_(E(r), this.locale)),
+ u,
+ f,
+ a.query,
+ function(t) {
+ return j({ pathname: t }, u).pathname;
+ },
+ this.locales
+ )).matchedPage &&
+ v.resolvedHref &&
+ ((c = v.resolvedHref),
+ (i = v.resolvedHref),
+ (a.pathname = i),
+ (e = (0, h.formatWithValidation)(a)),
+ (l = v.asPath));
+ case 19:
+ t.next = 21;
+ break;
+ case 21:
return (
- (c = (0, s.removePathTrailingSlash)(i)),
- (t.next = 15),
+ (t.next = 23),
Promise.all([
this.pageLoader._isSsg(e).then(function(t) {
return (
!!t &&
- l._getStaticData(
- l.pageLoader.getDataHref(
+ m._getStaticData(
+ m.pageLoader.getDataHref(
e,
- r,
+ l,
!0,
"undefined" !== typeof o.locale
? o.locale
- : l.locale
+ : m.locale
)
)
);
@@ -1783,7 +1805,7 @@
](c)
])
);
- case 15:
+ case 23:
case "end":
return t.stop();
}
@@ -1876,7 +1898,7 @@
r = new URL(t, window.location.href).href;
return !this.isPreview && this.sdc[r]
? Promise.resolve(this.sdc[r])
- : A(t, this.isSsr).then(function(t) {
+ : M(t, this.isSsr).then(function(t) {
return (e.sdc[r] = t), t;
});
}
@@ -1884,7 +1906,7 @@
{
key: "_getServerData",
value: function(t) {
- return A(t, this.isSsr);
+ return M(t, this.isSsr);
}
},
{
@@ -1907,7 +1929,7 @@
key: "abortComponentLoad",
value: function(e, r) {
this.clc &&
- (t.events.emit("routeChangeError", w(), e, r),
+ (t.events.emit("routeChangeError", b(), e, r),
this.clc(),
(this.clc = null));
}
@@ -1922,7 +1944,7 @@
t
);
})();
- (e.default = D), (D.events = (0, f.default)());
+ (e.default = N), (N.events = (0, f.default)());
},
"g/15": function(t, e, r) {
"use strict";
Diff for index.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/",
"query": {},
- "buildId": "oO-Cnzsu-EJdGqIJl-6Fq",
+ "buildId": "6U-IK9eCN6GmHOQ7Wf4rY",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/oO-Cnzsu-EJdGqIJl-6Fq/_buildManifest.js"
+ src="/_next/static/6U-IK9eCN6GmHOQ7Wf4rY/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/oO-Cnzsu-EJdGqIJl-6Fq/_ssgManifest.js"
+ src="/_next/static/6U-IK9eCN6GmHOQ7Wf4rY/_ssgManifest.js"
async=""
></script>
</body>
Diff for link.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -48,7 +48,7 @@
"props": { "pageProps": {} },
"page": "/link",
"query": {},
- "buildId": "oO-Cnzsu-EJdGqIJl-6Fq",
+ "buildId": "6U-IK9eCN6GmHOQ7Wf4rY",
"isFallback": false,
"gip": true
}
@@ -70,7 +70,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -82,11 +82,11 @@
async=""
></script>
<script
- src="/_next/static/oO-Cnzsu-EJdGqIJl-6Fq/_buildManifest.js"
+ src="/_next/static/6U-IK9eCN6GmHOQ7Wf4rY/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/oO-Cnzsu-EJdGqIJl-6Fq/_ssgManifest.js"
+ src="/_next/static/6U-IK9eCN6GmHOQ7Wf4rY/_ssgManifest.js"
async=""
></script>
</body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
as="script"
/>
<link
@@ -43,7 +43,7 @@
"props": { "pageProps": {} },
"page": "/withRouter",
"query": {},
- "buildId": "oO-Cnzsu-EJdGqIJl-6Fq",
+ "buildId": "6U-IK9eCN6GmHOQ7Wf4rY",
"isFallback": false,
"gip": true
}
@@ -65,7 +65,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.1ea7e9fd8a47d7a7db13.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
async=""
></script>
<script
@@ -77,11 +77,11 @@
async=""
></script>
<script
- src="/_next/static/oO-Cnzsu-EJdGqIJl-6Fq/_buildManifest.js"
+ src="/_next/static/6U-IK9eCN6GmHOQ7Wf4rY/_buildManifest.js"
async=""
></script>
<script
- src="/_next/static/oO-Cnzsu-EJdGqIJl-6Fq/_ssgManifest.js"
+ src="/_next/static/6U-IK9eCN6GmHOQ7Wf4rY/_ssgManifest.js"
async=""
></script>
</body>
This was referenced Mar 5, 2021
This was referenced Mar 8, 2021
This was referenced Mar 15, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This ensures we handle resolve rewrites during prefetching the same way we do during a client-transition. Previously if a rewritten source was used in an
href
neither the page bundle or SSG data if needed would be prefetched although would work correctly on a client transition.Fixes: #22441