-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Prefetch SSG Data #10127
Prefetch SSG Data #10127
Conversation
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 13.7s | 13.7s | |
nodeModulesSize | 48.9 MB | 48.9 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.1 kB | 5.18 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..e54b.js gzip | 13.7 kB | 13.7 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 67.4 kB | 67.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.16 kB | 4.24 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 12.5 kB | 12.5 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 62.1 kB | 62.2 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.33 kB | 1.33 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.9 kB | 2.94 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.87 kB | 9.9 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 757 B | 757 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.47 kB | 2.49 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.41 kB | 7.43 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.02 kB | 1.03 kB | |
link.html gzip | 1.03 kB | 1.04 kB | |
withRouter.html gzip | 1.01 kB | 1.03 kB | |
Overall change | 3.07 kB | 3.1 kB |
Diffs
Diff for link.js
@@ -637,17 +637,22 @@
},
},
{
- key: 'getHref',
- value: function getHref() {
+ key: 'getHrefs',
+ value: function getHrefs() {
var pathname = window.location.pathname
var _this$formatUrls2 = this.formatUrls(
this.props.href,
this.props.as
),
- parsedHref = _this$formatUrls2.href
+ href = _this$formatUrls2.href,
+ as = _this$formatUrls2.as
- return (0, _url.resolve)(pathname, parsedHref)
+ var parsedHref = (0, _url.resolve)(pathname, href)
+ return {
+ href: parsedHref,
+ as: as ? (0, _url.resolve)(pathname, as) : parsedHref,
+ }
},
},
{
@@ -655,7 +660,7 @@
value: function handleRef(ref) {
var _this2 = this
- var isPrefetched = prefetched[this.getHref()]
+ var isPrefetched = prefetched[this.getHrefs().href]
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners()
@@ -677,9 +682,14 @@
value: function prefetch() {
if (!this.p || false) return // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref()
+ var _this$getHrefs = this.getHrefs(),
+ href = _this$getHrefs.href,
+ as = _this$getHrefs.as
+
+ _router['default'].prefetch(href) // Cast to any because this is a private method, might be public in the
+ // future
- _router['default'].prefetch(href)
+ _router['default'].prefetchAs(as)
prefetched[href] = true
},
Diff for link.module.js
@@ -487,17 +487,18 @@
this.cleanUpListeners()
}
- getHref() {
+ getHrefs() {
var { pathname } = window.location
- var { href: parsedHref } = this.formatUrls(
- this.props.href,
- this.props.as
- )
- return (0, _url.resolve)(pathname, parsedHref)
+ var { href, as } = this.formatUrls(this.props.href, this.props.as)
+ var parsedHref = (0, _url.resolve)(pathname, href)
+ return {
+ href: parsedHref,
+ as: as ? (0, _url.resolve)(pathname, as) : parsedHref,
+ }
}
handleRef(ref) {
- var isPrefetched = prefetched[this.getHref()]
+ var isPrefetched = prefetched[this.getHrefs().href]
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners()
@@ -514,9 +515,12 @@
prefetch() {
if (!this.p || false) return // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref()
+ var { href, as } = this.getHrefs()
+
+ _router.default.prefetch(href) // Cast to any because this is a private method, might be public in the
+ // future
- _router.default.prefetch(href)
+ _router.default.prefetchAs(as)
prefetched[href] = true
}
Diff for de003c3a9d30..e4.module.js
@@ -2364,6 +2364,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
})
}
+ prefetchAs(url) {
+ return new _Promise((resolve, reject) => {
+ var { pathname, protocol } = url_1.parse(url)
+
+ if (!pathname || protocol || false) {
+ return
+ }
+
+ this.pageLoader.prefetchAs(pathname).then(resolve, reject)
+ })
+ }
+
async fetchComponent(route) {
var cancelled = false
Diff for de003c3a9d30..0b02858bf.js
@@ -2100,6 +2100,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
})
},
},
+ {
+ key: 'prefetchAs',
+ value: function prefetchAs(url) {
+ var _this5 = this
+
+ return new _Promise(function(resolve, reject) {
+ var _url_1$parse4 = url_1.parse(url),
+ pathname = _url_1$parse4.pathname,
+ protocol = _url_1$parse4.protocol
+
+ if (!pathname || protocol || false) {
+ return
+ }
+
+ _this5.pageLoader.prefetchAs(pathname).then(resolve, reject)
+ })
+ },
+ },
{
key: 'fetchComponent',
value: function fetchComponent(route) {
@@ -2158,7 +2176,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 _this6 = this
var cancelled = false
@@ -2168,8 +2186,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 === _this6.clc) {
+ _this6.clc = null
}
if (cancelled) {
Diff for main-HASH.js
@@ -1275,11 +1275,24 @@
resolve(window.__BUILD_MANIFEST)
} else {
window.__BUILD_MANIFEST_CB = function() {
- resolve(window.__BUILD_MANIFEST)
+ return resolve(window.__BUILD_MANIFEST)
}
}
})
}
+ /** @type {Promise<RegExp[]>} */
+
+ this.promisedSsgManifest = new _promise['default'](function(
+ resolve
+ ) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST)
+ } else {
+ window.__SSG_MANIFEST_CB = function() {
+ return resolve(window.__SSG_MANIFEST)
+ }
+ }
+ })
} // Returns a promise for the dependencies for a particular route
_createClass(PageLoader, [
@@ -1298,6 +1311,32 @@
)
})
},
+ /** @param {string} asPath */
+ },
+ {
+ key: 'prefetchAs',
+ value: function prefetchAs(asPath) {
+ var _this2 = this
+
+ asPath = normalizeRoute(asPath)
+ return this.promisedSsgManifest.then(function(m) {
+ return (
+ m.some(function(r) {
+ return r.test(asPath)
+ }) &&
+ appendLink(
+ _this2.assetPrefix +
+ '/_next/' +
+ _this2.buildId +
+ '/' +
+ (asPath === '/' ? '/index' : asPath) +
+ '.json',
+ relPrefetch,
+ 'fetch'
+ )
+ )
+ })
+ },
},
{
key: 'loadPage',
@@ -1310,7 +1349,7 @@
{
key: 'loadPageScript',
value: function loadPageScript(route) {
- var _this2 = this
+ var _this3 = this
route = normalizeRoute(route)
return new _promise['default'](function(resolve, reject) {
@@ -1319,9 +1358,9 @@
page = _ref.page,
mod = _ref.mod
- _this2.pageRegisterEvents.off(route, fire)
+ _this3.pageRegisterEvents.off(route, fire)
- delete _this2.loadingRoutes[route]
+ delete _this3.loadingRoutes[route]
if (error) {
reject(error)
@@ -1333,7 +1372,7 @@
}
} // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route]
+ var cachedPage = _this3.pageCache[route]
if (cachedPage) {
var error = cachedPage.error,
@@ -1348,7 +1387,7 @@
return
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire) // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire) // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
if (
@@ -1359,17 +1398,17 @@
return
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true
if (true) {
- _this2.getDependencies(route).then(function(deps) {
+ _this3.getDependencies(route).then(function(deps) {
deps.forEach(function(d) {
if (
/\.js$/.test(d) &&
!document.querySelector('script[src^="' + d + '"]')
) {
- _this2.loadScript(d, route, false)
+ _this3.loadScript(d, route, false)
}
if (
@@ -1385,7 +1424,7 @@
}
})
- _this2.loadRoute(route)
+ _this3.loadRoute(route)
})
} else {
}
@@ -1410,7 +1449,7 @@
{
key: 'loadScript',
value: function loadScript(url, route, isPage) {
- var _this3 = this
+ var _this4 = this
var script = document.createElement('script')
@@ -1428,7 +1467,7 @@
var error = new Error('Error loading script ' + url)
error.code = 'PAGE_LOAD_ERROR'
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error,
})
}
@@ -1439,7 +1478,7 @@
{
key: 'registerPage',
value: function registerPage(route, regFn) {
- var _this4 = this
+ var _this5 = this
var register = function register() {
try {
@@ -1448,15 +1487,15 @@
page: mod['default'] || mod,
mod: mod,
}
- _this4.pageCache[route] = pageData
+ _this5.pageCache[route] = pageData
- _this4.pageRegisterEvents.emit(route, pageData)
+ _this5.pageRegisterEvents.emit(route, pageData)
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error,
}
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error,
})
}
@@ -1468,11 +1507,15 @@
register()
},
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
},
{
key: 'prefetch',
value: function prefetch(route, isDependency) {
- var _this5 = this
+ var _this6 = this
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1483,6 +1526,7 @@
if (cn.saveData || /2g/.test(cn.effectiveType))
return _promise['default'].resolve()
}
+ /** @type {string} */
var url
@@ -1527,7 +1571,7 @@
this.getDependencies(route).then(function(urls) {
return _promise['default'].all(
urls.map(function(url) {
- return _this5.prefetch(url, true)
+ return _this6.prefetch(url, true)
})
)
}),
Diff for main-HASH.module.js
@@ -860,12 +860,20 @@
if (window.__BUILD_MANIFEST) {
resolve(window.__BUILD_MANIFEST)
} else {
- window.__BUILD_MANIFEST_CB = () => {
+ window.__BUILD_MANIFEST_CB = () =>
resolve(window.__BUILD_MANIFEST)
- }
}
})
}
+ /** @type {Promise<RegExp[]>} */
+
+ this.promisedSsgManifest = new _promise.default(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST)
+ } else {
+ window.__SSG_MANIFEST_CB = () => resolve(window.__SSG_MANIFEST)
+ }
+ })
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
@@ -878,6 +886,25 @@
[]
)
}
+ /** @param {string} asPath */
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath)
+ return this.promisedSsgManifest.then(
+ m =>
+ m.some(r => r.test(asPath)) &&
+ appendLink(
+ this.assetPrefix +
+ '/_next/' +
+ this.buildId +
+ '/' +
+ (asPath === '/' ? '/index' : asPath) +
+ '.json',
+ relPrefetch,
+ 'fetch'
+ )
+ )
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page)
@@ -1018,6 +1045,10 @@
register()
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -1029,6 +1060,7 @@
if (cn.saveData || /2g/.test(cn.effectiveType))
return _promise.default.resolve()
}
+ /** @type {string} */
var url
Diff for index.html
@@ -39,13 +39,13 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
as="script"
crossorigin="anonymous"
/>
<link
rel="preload"
- href="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ href="/_next/static/runtime/main-3f96d2421fe499974f36.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -151,25 +151,25 @@
type="module"
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.dc074a37be5825f3659c.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
defer=""
crossorigin="anonymous"
type="module"
></script
><script
- src="/_next/static/runtime/main-b88ab0b3125aefaa36de.js"
+ src="/_next/static/runtime/main-d0a5f07358ecdd560fbe.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ src="/_next/static/runtime/main-3f96d2421fe499974f36.module.js"
defer=""
crossorigin="anonymous"
type="module"
@@ -185,6 +185,18 @@
defer=""
crossorigin="anonymous"
type="module"
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.js"
+ defer=""
+ crossorigin="anonymous"
+ nomodule=""
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.module.js"
+ defer=""
+ crossorigin="anonymous"
+ type="module"
></script>
</body>
</html>
Diff for link.html
@@ -39,13 +39,13 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
as="script"
crossorigin="anonymous"
/>
<link
rel="preload"
- href="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ href="/_next/static/runtime/main-3f96d2421fe499974f36.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -156,25 +156,25 @@
type="module"
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.dc074a37be5825f3659c.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
defer=""
crossorigin="anonymous"
type="module"
></script
><script
- src="/_next/static/runtime/main-b88ab0b3125aefaa36de.js"
+ src="/_next/static/runtime/main-d0a5f07358ecdd560fbe.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ src="/_next/static/runtime/main-3f96d2421fe499974f36.module.js"
defer=""
crossorigin="anonymous"
type="module"
@@ -190,6 +190,18 @@
defer=""
crossorigin="anonymous"
type="module"
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.js"
+ defer=""
+ crossorigin="anonymous"
+ nomodule=""
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.module.js"
+ defer=""
+ crossorigin="anonymous"
+ type="module"
></script>
</body>
</html>
Diff for withRouter.html
@@ -39,13 +39,13 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
as="script"
crossorigin="anonymous"
/>
<link
rel="preload"
- href="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ href="/_next/static/runtime/main-3f96d2421fe499974f36.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -151,25 +151,25 @@
type="module"
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.dc074a37be5825f3659c.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
defer=""
crossorigin="anonymous"
type="module"
></script
><script
- src="/_next/static/runtime/main-b88ab0b3125aefaa36de.js"
+ src="/_next/static/runtime/main-d0a5f07358ecdd560fbe.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ src="/_next/static/runtime/main-3f96d2421fe499974f36.module.js"
defer=""
crossorigin="anonymous"
type="module"
@@ -185,6 +185,18 @@
defer=""
crossorigin="anonymous"
type="module"
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.js"
+ defer=""
+ crossorigin="anonymous"
+ nomodule=""
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.module.js"
+ defer=""
+ crossorigin="anonymous"
+ type="module"
></script>
</body>
</html>
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 14.1s | 14.1s | -7ms |
nodeModulesSize | 48.9 MB | 48.9 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.1 kB | 5.18 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..e54b.js gzip | 13.7 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..8224.js gzip | N/A | 13.7 kB | N/A |
Overall change | 67.4 kB | 67.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.16 kB | 4.24 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 12.5 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 12.5 kB | N/A |
Overall change | 62.1 kB | 62.2 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.33 kB | 1.33 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.9 kB | 2.94 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.87 kB | 9.9 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 757 B | 757 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.47 kB | 2.49 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.41 kB | 7.43 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 77.8 kB | 77.8 kB | |
hooks.html gzip | 1.05 kB | 1.07 kB | |
index.js gzip | 78 kB | 78 kB | |
link.js gzip | 80.4 kB | 80.5 kB | |
routerDirect.js gzip | 78.1 kB | 78.1 kB | |
withRouter.js gzip | 78.1 kB | 78.2 kB | |
Overall change | 393 kB | 394 kB |
Commit: 190a914
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 14.1s | 13.9s | -199ms |
nodeModulesSize | 48.9 MB | 48.9 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.1 kB | 5.19 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..e54b.js gzip | 13.7 kB | 13.7 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 67.4 kB | 67.6 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.16 kB | 4.24 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 12.5 kB | 12.5 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 62.1 kB | 62.2 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.33 kB | 1.33 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.9 kB | 2.94 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.87 kB | 9.9 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 757 B | 757 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.47 kB | 2.49 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.41 kB | 7.43 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.02 kB | 1.03 kB | |
link.html gzip | 1.03 kB | 1.04 kB | |
withRouter.html gzip | 1.01 kB | 1.02 kB | |
Overall change | 3.07 kB | 3.09 kB |
Diffs
Diff for link.js
@@ -637,17 +637,22 @@
},
},
{
- key: 'getHref',
- value: function getHref() {
+ key: 'getHrefs',
+ value: function getHrefs() {
var pathname = window.location.pathname
var _this$formatUrls2 = this.formatUrls(
this.props.href,
this.props.as
),
- parsedHref = _this$formatUrls2.href
+ href = _this$formatUrls2.href,
+ as = _this$formatUrls2.as
- return (0, _url.resolve)(pathname, parsedHref)
+ var parsedHref = (0, _url.resolve)(pathname, href)
+ return {
+ href: parsedHref,
+ as: as ? (0, _url.resolve)(pathname, as) : parsedHref,
+ }
},
},
{
@@ -655,7 +660,7 @@
value: function handleRef(ref) {
var _this2 = this
- var isPrefetched = prefetched[this.getHref()]
+ var isPrefetched = prefetched[this.getHrefs().href]
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners()
@@ -677,9 +682,14 @@
value: function prefetch() {
if (!this.p || false) return // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref()
+ var _this$getHrefs = this.getHrefs(),
+ href = _this$getHrefs.href,
+ as = _this$getHrefs.as
+
+ _router['default'].prefetch(href) // Cast to any because this is a private method, might be public in the
+ // future
- _router['default'].prefetch(href)
+ _router['default'].prefetchAs(as)
prefetched[href] = true
},
Diff for link.module.js
@@ -487,17 +487,18 @@
this.cleanUpListeners()
}
- getHref() {
+ getHrefs() {
var { pathname } = window.location
- var { href: parsedHref } = this.formatUrls(
- this.props.href,
- this.props.as
- )
- return (0, _url.resolve)(pathname, parsedHref)
+ var { href, as } = this.formatUrls(this.props.href, this.props.as)
+ var parsedHref = (0, _url.resolve)(pathname, href)
+ return {
+ href: parsedHref,
+ as: as ? (0, _url.resolve)(pathname, as) : parsedHref,
+ }
}
handleRef(ref) {
- var isPrefetched = prefetched[this.getHref()]
+ var isPrefetched = prefetched[this.getHrefs().href]
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners()
@@ -514,9 +515,12 @@
prefetch() {
if (!this.p || false) return // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref()
+ var { href, as } = this.getHrefs()
+
+ _router.default.prefetch(href) // Cast to any because this is a private method, might be public in the
+ // future
- _router.default.prefetch(href)
+ _router.default.prefetchAs(as)
prefetched[href] = true
}
Diff for de003c3a9d30..e4.module.js
@@ -2364,6 +2364,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
})
}
+ prefetchAs(url) {
+ return new _Promise((resolve, reject) => {
+ var { pathname, protocol } = url_1.parse(url)
+
+ if (!pathname || protocol || false) {
+ return
+ }
+
+ this.pageLoader.prefetchAs(pathname).then(resolve, reject)
+ })
+ }
+
async fetchComponent(route) {
var cancelled = false
Diff for de003c3a9d30..0b02858bf.js
@@ -2100,6 +2100,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
})
},
},
+ {
+ key: 'prefetchAs',
+ value: function prefetchAs(url) {
+ var _this5 = this
+
+ return new _Promise(function(resolve, reject) {
+ var _url_1$parse4 = url_1.parse(url),
+ pathname = _url_1$parse4.pathname,
+ protocol = _url_1$parse4.protocol
+
+ if (!pathname || protocol || false) {
+ return
+ }
+
+ _this5.pageLoader.prefetchAs(pathname).then(resolve, reject)
+ })
+ },
+ },
{
key: 'fetchComponent',
value: function fetchComponent(route) {
@@ -2158,7 +2176,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 _this6 = this
var cancelled = false
@@ -2168,8 +2186,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 === _this6.clc) {
+ _this6.clc = null
}
if (cancelled) {
Diff for main-HASH.js
@@ -1275,11 +1275,24 @@
resolve(window.__BUILD_MANIFEST)
} else {
window.__BUILD_MANIFEST_CB = function() {
- resolve(window.__BUILD_MANIFEST)
+ return resolve(window.__BUILD_MANIFEST)
}
}
})
}
+ /** @type {Promise<RegExp[]>} */
+
+ this.promisedSsgManifest = new _promise['default'](function(
+ resolve
+ ) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST)
+ } else {
+ window.__SSG_MANIFEST_CB = function() {
+ return resolve(window.__SSG_MANIFEST)
+ }
+ }
+ })
} // Returns a promise for the dependencies for a particular route
_createClass(PageLoader, [
@@ -1298,6 +1311,32 @@
)
})
},
+ /** @param {string} asPath */
+ },
+ {
+ key: 'prefetchAs',
+ value: function prefetchAs(asPath) {
+ var _this2 = this
+
+ asPath = normalizeRoute(asPath)
+ return this.promisedSsgManifest.then(function(m) {
+ return (
+ m.some(function(r) {
+ return r.test(asPath)
+ }) &&
+ appendLink(
+ _this2.assetPrefix +
+ '/_next/data/' +
+ _this2.buildId +
+ '/' +
+ (asPath === '/' ? '/index' : asPath) +
+ '.json',
+ relPrefetch,
+ 'fetch'
+ )
+ )
+ })
+ },
},
{
key: 'loadPage',
@@ -1310,7 +1349,7 @@
{
key: 'loadPageScript',
value: function loadPageScript(route) {
- var _this2 = this
+ var _this3 = this
route = normalizeRoute(route)
return new _promise['default'](function(resolve, reject) {
@@ -1319,9 +1358,9 @@
page = _ref.page,
mod = _ref.mod
- _this2.pageRegisterEvents.off(route, fire)
+ _this3.pageRegisterEvents.off(route, fire)
- delete _this2.loadingRoutes[route]
+ delete _this3.loadingRoutes[route]
if (error) {
reject(error)
@@ -1333,7 +1372,7 @@
}
} // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route]
+ var cachedPage = _this3.pageCache[route]
if (cachedPage) {
var error = cachedPage.error,
@@ -1348,7 +1387,7 @@
return
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire) // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire) // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
if (
@@ -1359,17 +1398,17 @@
return
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true
if (true) {
- _this2.getDependencies(route).then(function(deps) {
+ _this3.getDependencies(route).then(function(deps) {
deps.forEach(function(d) {
if (
/\.js$/.test(d) &&
!document.querySelector('script[src^="' + d + '"]')
) {
- _this2.loadScript(d, route, false)
+ _this3.loadScript(d, route, false)
}
if (
@@ -1385,7 +1424,7 @@
}
})
- _this2.loadRoute(route)
+ _this3.loadRoute(route)
})
} else {
}
@@ -1410,7 +1449,7 @@
{
key: 'loadScript',
value: function loadScript(url, route, isPage) {
- var _this3 = this
+ var _this4 = this
var script = document.createElement('script')
@@ -1428,7 +1467,7 @@
var error = new Error('Error loading script ' + url)
error.code = 'PAGE_LOAD_ERROR'
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error,
})
}
@@ -1439,7 +1478,7 @@
{
key: 'registerPage',
value: function registerPage(route, regFn) {
- var _this4 = this
+ var _this5 = this
var register = function register() {
try {
@@ -1448,15 +1487,15 @@
page: mod['default'] || mod,
mod: mod,
}
- _this4.pageCache[route] = pageData
+ _this5.pageCache[route] = pageData
- _this4.pageRegisterEvents.emit(route, pageData)
+ _this5.pageRegisterEvents.emit(route, pageData)
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error,
}
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error,
})
}
@@ -1468,11 +1507,15 @@
register()
},
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
},
{
key: 'prefetch',
value: function prefetch(route, isDependency) {
- var _this5 = this
+ var _this6 = this
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1483,6 +1526,7 @@
if (cn.saveData || /2g/.test(cn.effectiveType))
return _promise['default'].resolve()
}
+ /** @type {string} */
var url
@@ -1527,7 +1571,7 @@
this.getDependencies(route).then(function(urls) {
return _promise['default'].all(
urls.map(function(url) {
- return _this5.prefetch(url, true)
+ return _this6.prefetch(url, true)
})
)
}),
Diff for main-HASH.module.js
@@ -860,12 +860,20 @@
if (window.__BUILD_MANIFEST) {
resolve(window.__BUILD_MANIFEST)
} else {
- window.__BUILD_MANIFEST_CB = () => {
+ window.__BUILD_MANIFEST_CB = () =>
resolve(window.__BUILD_MANIFEST)
- }
}
})
}
+ /** @type {Promise<RegExp[]>} */
+
+ this.promisedSsgManifest = new _promise.default(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST)
+ } else {
+ window.__SSG_MANIFEST_CB = () => resolve(window.__SSG_MANIFEST)
+ }
+ })
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
@@ -878,6 +886,25 @@
[]
)
}
+ /** @param {string} asPath */
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath)
+ return this.promisedSsgManifest.then(
+ m =>
+ m.some(r => r.test(asPath)) &&
+ appendLink(
+ this.assetPrefix +
+ '/_next/data/' +
+ this.buildId +
+ '/' +
+ (asPath === '/' ? '/index' : asPath) +
+ '.json',
+ relPrefetch,
+ 'fetch'
+ )
+ )
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page)
@@ -1018,6 +1045,10 @@
register()
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -1029,6 +1060,7 @@
if (cn.saveData || /2g/.test(cn.effectiveType))
return _promise.default.resolve()
}
+ /** @type {string} */
var url
Diff for index.html
@@ -39,13 +39,13 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
as="script"
crossorigin="anonymous"
/>
<link
rel="preload"
- href="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ href="/_next/static/runtime/main-e7ad98e195bc44bbc080.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -151,25 +151,25 @@
type="module"
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.dc074a37be5825f3659c.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
defer=""
crossorigin="anonymous"
type="module"
></script
><script
- src="/_next/static/runtime/main-b88ab0b3125aefaa36de.js"
+ src="/_next/static/runtime/main-4b01a3a3748816eaf9b4.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ src="/_next/static/runtime/main-e7ad98e195bc44bbc080.module.js"
defer=""
crossorigin="anonymous"
type="module"
@@ -185,6 +185,18 @@
defer=""
crossorigin="anonymous"
type="module"
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.js"
+ defer=""
+ crossorigin="anonymous"
+ nomodule=""
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.module.js"
+ defer=""
+ crossorigin="anonymous"
+ type="module"
></script>
</body>
</html>
Diff for link.html
@@ -39,13 +39,13 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
as="script"
crossorigin="anonymous"
/>
<link
rel="preload"
- href="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ href="/_next/static/runtime/main-e7ad98e195bc44bbc080.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -156,25 +156,25 @@
type="module"
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.dc074a37be5825f3659c.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
defer=""
crossorigin="anonymous"
type="module"
></script
><script
- src="/_next/static/runtime/main-b88ab0b3125aefaa36de.js"
+ src="/_next/static/runtime/main-4b01a3a3748816eaf9b4.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ src="/_next/static/runtime/main-e7ad98e195bc44bbc080.module.js"
defer=""
crossorigin="anonymous"
type="module"
@@ -190,6 +190,18 @@
defer=""
crossorigin="anonymous"
type="module"
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.js"
+ defer=""
+ crossorigin="anonymous"
+ nomodule=""
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.module.js"
+ defer=""
+ crossorigin="anonymous"
+ type="module"
></script>
</body>
</html>
Diff for withRouter.html
@@ -39,13 +39,13 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
as="script"
crossorigin="anonymous"
/>
<link
rel="preload"
- href="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ href="/_next/static/runtime/main-e7ad98e195bc44bbc080.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -151,25 +151,25 @@
type="module"
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.dc074a37be5825f3659c.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+ src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.0c3341f3299e2cb62278.module.js"
defer=""
crossorigin="anonymous"
type="module"
></script
><script
- src="/_next/static/runtime/main-b88ab0b3125aefaa36de.js"
+ src="/_next/static/runtime/main-4b01a3a3748816eaf9b4.js"
defer=""
crossorigin="anonymous"
nomodule=""
></script
><script
- src="/_next/static/runtime/main-c1f681b026529749e230.module.js"
+ src="/_next/static/runtime/main-e7ad98e195bc44bbc080.module.js"
defer=""
crossorigin="anonymous"
type="module"
@@ -185,6 +185,18 @@
defer=""
crossorigin="anonymous"
type="module"
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.js"
+ defer=""
+ crossorigin="anonymous"
+ nomodule=""
+ ></script
+ ><script
+ src="/_next/static/BUILD_ID/_ssgManifest.module.js"
+ defer=""
+ crossorigin="anonymous"
+ type="module"
></script>
</body>
</html>
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 14.8s | 14.5s | -279ms |
nodeModulesSize | 48.9 MB | 48.9 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.1 kB | 5.19 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..e54b.js gzip | 13.7 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..8224.js gzip | N/A | 13.7 kB | N/A |
Overall change | 67.4 kB | 67.6 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.16 kB | 4.24 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 12.5 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 12.5 kB | N/A |
Overall change | 62.1 kB | 62.2 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.33 kB | 1.33 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.9 kB | 2.94 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.87 kB | 9.9 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 757 B | 757 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.47 kB | 2.49 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.41 kB | 7.43 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 77.8 kB | 77.8 kB | |
hooks.html gzip | 1.05 kB | 1.06 kB | |
index.js gzip | 78 kB | 78 kB | |
link.js gzip | 80.4 kB | 80.5 kB | |
routerDirect.js gzip | 78.1 kB | 78.1 kB | |
withRouter.js gzip | 78.1 kB | 78.2 kB | |
Overall change | 393 kB | 394 kB |
Commit: 630f516
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 11.3s | 10.9s | -444ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.21 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.05 kB | |
link.html gzip | 1.04 kB | 1.05 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.15 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-6d0b53b18aad7891fbaf.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -794,18 +794,33 @@ class PageLoader {
if (window.__BUILD_MANIFEST) {
resolve(window.__BUILD_MANIFEST);
} else {
- window.__BUILD_MANIFEST_CB = () => {
- resolve(window.__BUILD_MANIFEST);
- };
+ window.__BUILD_MANIFEST_CB = () => resolve(window.__BUILD_MANIFEST);
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => resolve(window.__SSG_MANIFEST);
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(m => m.some(r => r.test(asPath)) && appendLink(this.assetPrefix + "/_next/data/" + this.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +951,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +966,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1093,11 +1093,23 @@ function () {
resolve(window.__BUILD_MANIFEST);
} else {
window.__BUILD_MANIFEST_CB = function () {
- resolve(window.__BUILD_MANIFEST);
+ return resolve(window.__BUILD_MANIFEST);
};
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ return resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && appendLink(_this2.assetPrefix + "/_next/data/" + _this2.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-6d0b53b18aad7891fbaf.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-6d0b53b18aad7891fbaf.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 12.1s | 12s | -120ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.21 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 289 kB | 290 kB | |
404.html gzip | 1.45 kB | 1.46 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 289 kB | 289 kB | |
link.js gzip | 319 kB | 319 kB | |
routerDirect.js gzip | 316 kB | 316 kB | |
withRouter.js gzip | 316 kB | 316 kB | |
Overall change | 1.53 MB | 1.53 MB |
Commit: 555b097
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.9s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.21 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.05 kB | |
link.html gzip | 1.04 kB | 1.05 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.15 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-6d0b53b18aad7891fbaf.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -794,18 +794,33 @@ class PageLoader {
if (window.__BUILD_MANIFEST) {
resolve(window.__BUILD_MANIFEST);
} else {
- window.__BUILD_MANIFEST_CB = () => {
- resolve(window.__BUILD_MANIFEST);
- };
+ window.__BUILD_MANIFEST_CB = () => resolve(window.__BUILD_MANIFEST);
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => resolve(window.__SSG_MANIFEST);
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(m => m.some(r => r.test(asPath)) && appendLink(this.assetPrefix + "/_next/data/" + this.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +951,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +966,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1093,11 +1093,23 @@ function () {
resolve(window.__BUILD_MANIFEST);
} else {
window.__BUILD_MANIFEST_CB = function () {
- resolve(window.__BUILD_MANIFEST);
+ return resolve(window.__BUILD_MANIFEST);
};
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ return resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && appendLink(_this2.assetPrefix + "/_next/data/" + _this2.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-6d0b53b18aad7891fbaf.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-6d0b53b18aad7891fbaf.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-2a8e508021dae1d67bf1.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 12.9s | 13.1s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.21 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 290 kB | 290 kB | -13 B |
404.html gzip | 1.45 kB | 1.46 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 289 kB | 289 kB | |
link.js gzip | 319 kB | 319 kB | -538 B |
routerDirect.js gzip | 316 kB | 316 kB | |
withRouter.js gzip | 315 kB | 316 kB | |
Overall change | 1.53 MB | 1.53 MB | -188 B |
Commit: 555b097
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 12s | 12.1s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.22 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.05 kB | |
link.html gzip | 1.04 kB | 1.05 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.14 kB |
Diffs
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -800,12 +800,31 @@ class PageLoader {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(m => m.some(r => r.test(asPath)) && appendLink(this.assetPrefix + "/_next/data/" + this.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +955,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +970,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1098,6 +1098,18 @@ function () {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && appendLink(_this2.assetPrefix + "/_next/data/" + _this2.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 12.9s | 12.6s | -352ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.22 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 289 kB | 289 kB | |
404.html gzip | 1.45 kB | 1.45 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 289 kB | 290 kB | |
link.js gzip | 320 kB | 319 kB | -489 B |
routerDirect.js gzip | 316 kB | 316 kB | -426 B |
withRouter.js gzip | 315 kB | 315 kB | |
Overall change | 1.53 MB | 1.53 MB |
Commit: 98852c4
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.8s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.22 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.05 kB | |
link.html gzip | 1.04 kB | 1.05 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.14 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -800,12 +800,31 @@ class PageLoader {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(m => m.some(r => r.test(asPath)) && appendLink(this.assetPrefix + "/_next/data/" + this.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +955,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +970,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1098,6 +1098,18 @@ function () {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && appendLink(_this2.assetPrefix + "/_next/data/" + _this2.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 13s | 12.8s | -168ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.22 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 290 kB | 289 kB | -438 B |
404.html gzip | 1.45 kB | 1.45 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 289 kB | 289 kB | -113 B |
link.js gzip | 319 kB | 319 kB | |
routerDirect.js gzip | 315 kB | 317 kB | |
withRouter.js gzip | 316 kB | 316 kB | -130 B |
Overall change | 1.53 MB | 1.53 MB |
Commit: 98852c4
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 10.6s | 10.4s | -255ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.22 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.05 kB | |
link.html gzip | 1.04 kB | 1.05 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.14 kB |
Diffs
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -800,12 +800,31 @@ class PageLoader {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(m => m.some(r => r.test(asPath)) && appendLink(this.assetPrefix + "/_next/data/" + this.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +955,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +970,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1098,6 +1098,18 @@ function () {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && appendLink(_this2.assetPrefix + "/_next/data/" + _this2.buildId + "/" + (asPath === '/' ? '/index' : asPath) + ".json", relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-1f11082673709e20a063.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-2d7029af6d4f0e01f155.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-1f11082673709e20a063.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 11.2s | 11.2s | -60ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.22 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | ✓ |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.22 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | ✓ |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.7 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.89 kB | ✓ |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.68 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.46 kB | ✓ |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.22 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 289 kB | 290 kB | |
404.html gzip | 1.45 kB | 1.45 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 289 kB | 289 kB | -169 B |
link.js gzip | 319 kB | 319 kB | -99 B |
routerDirect.js gzip | 317 kB | 316 kB | -496 B |
withRouter.js gzip | 316 kB | 315 kB | -834 B |
Overall change | 1.53 MB | 1.53 MB | -1.01 kB |
Commit: ed7bfc1
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 11.6s | 11.7s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.23 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.23 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.8 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.94 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.72 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.48 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.24 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.04 kB | |
link.html gzip | 1.04 kB | 1.05 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.14 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.14936e72600503cdec07.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.ae88a6b89f709e56e958.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.14936e72600503cdec07.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-fd4cfd4ad6331437f961.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -800,12 +800,31 @@ class PageLoader {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then((m, _href) => m.some(r => r.test(asPath)) && (_href = this.assetPrefix + "/_next/data/" + this.buildId + (asPath === '/' ? '/index' : asPath) + ".json", !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _href + "\"]")) && appendLink(_href, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +955,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +970,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1098,6 +1098,18 @@ function () {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m, _href) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && (_href = _this2.assetPrefix + "/_next/data/" + _this2.buildId + (asPath === '/' ? '/index' : asPath) + ".json", !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _href + "\"]")) && appendLink(_href, relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..57.module.js
@@ -3288,13 +3288,15 @@ class Router {
return this.asPath !== asPath;
}
/**
- * Prefetch `page` code, you may wait for the data during `page` rendering.
+ * Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
- * @param url of prefetched `page`
+ * @param url the href of prefetched page
+ * @param asPath the as path of the prefetched page
*/
prefetch(url) {
+ var asPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : url;
return new _Promise((resolve, reject) => {
var {
pathname,
@@ -3310,8 +3312,7 @@ class Router {
if (false) {}
- var route = toRoute(pathname);
- this.pageLoader.prefetch(route).then(resolve, reject);
+ _Promise.all([this.pageLoader.prefetch(toRoute(pathname)), this.pageLoader.prefetchAs(toRoute(asPath))]).then(() => resolve(), reject);
});
}
Diff for de003c3a9d30..291efaf38.js
@@ -3043,9 +3043,10 @@ function () {
return this.asPath !== asPath;
}
/**
- * Prefetch `page` code, you may wait for the data during `page` rendering.
+ * Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
- * @param url of prefetched `page`
+ * @param url the href of prefetched page
+ * @param asPath the as path of the prefetched page
*/
}, {
@@ -3053,6 +3054,7 @@ function () {
value: function prefetch(url) {
var _this4 = this;
+ var asPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : url;
return new _Promise(function (resolve, reject) {
var _url_1$parse4 = url_1.parse(url),
pathname = _url_1$parse4.pathname,
@@ -3067,9 +3069,9 @@ function () {
if (false) {}
- var route = toRoute(pathname);
-
- _this4.pageLoader.prefetch(route).then(resolve, reject);
+ _Promise.all([_this4.pageLoader.prefetch(toRoute(pathname)), _this4.pageLoader.prefetchAs(toRoute(asPath))]).then(function () {
+ return resolve();
+ }, reject);
});
}
}, {
Diff for link.module.js
@@ -448,18 +448,20 @@ class Link extends _react.Component {
this.cleanUpListeners();
}
- getHref() {
+ getPaths() {
var {
pathname
} = window.location;
var {
- href: parsedHref
+ href: parsedHref,
+ as: parsedAs
} = this.formatUrls(this.props.href, this.props.as);
- return (0, _url.resolve)(pathname, parsedHref);
+ var resolvedHref = (0, _url.resolve)(pathname, parsedHref);
+ return [resolvedHref, parsedAs ? (0, _url.resolve)(pathname, parsedAs) : resolvedHref];
}
handleRef(ref) {
- var isPrefetched = prefetched[this.getHref()];
+ var isPrefetched = prefetched[this.getPaths()[0]];
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners();
@@ -477,9 +479,9 @@ class Link extends _react.Component {
prefetch() {
if (!this.p || false) return; // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref();
+ var [href, asPath] = this.getPaths();
- _router.default.prefetch(href);
+ _router.default.prefetch(href, asPath);
prefetched[href] = true;
}
Diff for link.js
@@ -388,6 +388,8 @@ module.exports = _possibleConstructorReturn;
"use strict";
+var _slicedToArray = __webpack_require__("8+Nu");
+
var _classCallCheck = __webpack_require__("/HRN");
var _createClass = __webpack_require__("WaGi");
@@ -575,21 +577,23 @@ function (_react$Component) {
this.cleanUpListeners();
}
}, {
- key: "getHref",
- value: function getHref() {
+ key: "getPaths",
+ value: function getPaths() {
var pathname = window.location.pathname;
var _this$formatUrls2 = this.formatUrls(this.props.href, this.props.as),
- parsedHref = _this$formatUrls2.href;
+ parsedHref = _this$formatUrls2.href,
+ parsedAs = _this$formatUrls2.as;
- return (0, _url.resolve)(pathname, parsedHref);
+ var resolvedHref = (0, _url.resolve)(pathname, parsedHref);
+ return [resolvedHref, parsedAs ? (0, _url.resolve)(pathname, parsedAs) : resolvedHref];
}
}, {
key: "handleRef",
value: function handleRef(ref) {
var _this2 = this;
- var isPrefetched = prefetched[this.getHref()];
+ var isPrefetched = prefetched[this.getPaths()[0]];
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners();
@@ -608,9 +612,12 @@ function (_react$Component) {
value: function prefetch() {
if (!this.p || false) return; // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref();
+ var _this$getPaths = this.getPaths(),
+ _this$getPaths2 = _slicedToArray(_this$getPaths, 2),
+ href = _this$getPaths2[0],
+ asPath = _this$getPaths2[1];
- _router["default"].prefetch(href);
+ _router["default"].prefetch(href, asPath);
prefetched[href] = true;
}
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.14936e72600503cdec07.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.ae88a6b89f709e56e958.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.14936e72600503cdec07.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-fd4cfd4ad6331437f961.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.14936e72600503cdec07.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.ae88a6b89f709e56e958.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.14936e72600503cdec07.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-fd4cfd4ad6331437f961.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 13s | 12.5s | -463ms |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.23 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..e309.js gzip | N/A | 16.2 kB | N/A |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.23 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 15.1 kB | N/A |
Overall change | 64.7 kB | 64.8 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.94 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.72 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.48 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.24 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 289 kB | 289 kB | |
404.html gzip | 1.45 kB | 1.46 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 290 kB | 289 kB | -660 B |
link.js gzip | 319 kB | 319 kB | |
routerDirect.js gzip | 315 kB | 315 kB | |
withRouter.js gzip | 316 kB | 316 kB | |
Overall change | 1.53 MB | 1.53 MB | -51 B |
Commit: 6a25c93
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 12s | 12.3s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.23 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | 16.3 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.23 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | 15.1 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 64.7 kB | 64.8 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.96 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.74 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.51 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.27 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 1.03 kB | 1.05 kB | |
link.html gzip | 1.04 kB | 1.06 kB | |
withRouter.html gzip | 1.03 kB | 1.04 kB | |
Overall change | 3.11 kB | 3.15 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.8d696bd78889f5a6eddd.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.7abe18749252b8c9ffa2.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.8d696bd78889f5a6eddd.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-fd4cfd4ad6331437f961.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -800,12 +800,31 @@ class PageLoader {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /** @param {string} asPath */
+
+
+ prefetchAs(asPath) {
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then((m, _href) => m.some(r => r.test(asPath)) && (_href = this.assetPrefix + "/_next/data/" + this.buildId + (asPath === '/' ? '/index' : asPath) + ".json", !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _href + "\"]")) && appendLink(_href, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -936,6 +955,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -946,6 +970,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1098,6 +1098,18 @@ function () {
}
});
}
+ /** @type {Promise<RegExp[]>} */
+
+
+ this.promisedSsgManifest = new _Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1112,6 +1124,20 @@ function () {
}) || [];
});
}
+ /** @param {string} asPath */
+
+ }, {
+ key: "prefetchAs",
+ value: function prefetchAs(asPath) {
+ var _this2 = this;
+
+ asPath = normalizeRoute(asPath);
+ return this.promisedSsgManifest.then(function (m, _href) {
+ return m.some(function (r) {
+ return r.test(asPath);
+ }) && (_href = _this2.assetPrefix + "/_next/data/" + _this2.buildId + (asPath === '/' ? '/index' : asPath) + ".json", !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _href + "\"]")) && appendLink(_href, relPrefetch, 'fetch');
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1122,7 +1148,7 @@ function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new _Promise(function (resolve, reject) {
@@ -1131,9 +1157,9 @@ function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1146,7 +1172,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1160,7 +1186,7 @@ function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1168,14 +1194,14 @@ function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1185,7 +1211,7 @@ function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1202,7 +1228,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1220,7 +1246,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1231,7 +1257,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1240,15 +1266,15 @@ function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1258,10 +1284,15 @@ function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1271,6 +1302,8 @@ function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return _Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1289,7 +1322,7 @@ function () {
return _Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return _Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..57.module.js
@@ -3288,13 +3288,16 @@ class Router {
return this.asPath !== asPath;
}
/**
- * Prefetch `page` code, you may wait for the data during `page` rendering.
+ * Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
- * @param url of prefetched `page`
+ * @param url the href of prefetched page
+ * @param asPath the as path of the prefetched page
*/
prefetch(url) {
+ var asPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : url;
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return new _Promise((resolve, reject) => {
var {
pathname,
@@ -3310,8 +3313,7 @@ class Router {
if (false) {}
- var route = toRoute(pathname);
- this.pageLoader.prefetch(route).then(resolve, reject);
+ _Promise.all([this.pageLoader.prefetchAs(toRoute(asPath)), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for de003c3a9d30..291efaf38.js
@@ -3043,9 +3043,10 @@ function () {
return this.asPath !== asPath;
}
/**
- * Prefetch `page` code, you may wait for the data during `page` rendering.
+ * Prefetch page code, you may wait for the data during page rendering.
* This feature only works in production!
- * @param url of prefetched `page`
+ * @param url the href of prefetched page
+ * @param asPath the as path of the prefetched page
*/
}, {
@@ -3053,6 +3054,8 @@ function () {
value: function prefetch(url) {
var _this4 = this;
+ var asPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : url;
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return new _Promise(function (resolve, reject) {
var _url_1$parse4 = url_1.parse(url),
pathname = _url_1$parse4.pathname,
@@ -3067,9 +3070,9 @@ function () {
if (false) {}
- var route = toRoute(pathname);
-
- _this4.pageLoader.prefetch(route).then(resolve, reject);
+ _Promise.all([_this4.pageLoader.prefetchAs(toRoute(asPath)), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
+ return resolve();
+ }, reject);
});
}
}, {
Diff for link.module.js
@@ -448,18 +448,20 @@ class Link extends _react.Component {
this.cleanUpListeners();
}
- getHref() {
+ getPaths() {
var {
pathname
} = window.location;
var {
- href: parsedHref
+ href: parsedHref,
+ as: parsedAs
} = this.formatUrls(this.props.href, this.props.as);
- return (0, _url.resolve)(pathname, parsedHref);
+ var resolvedHref = (0, _url.resolve)(pathname, parsedHref);
+ return [resolvedHref, parsedAs ? (0, _url.resolve)(pathname, parsedAs) : resolvedHref];
}
handleRef(ref) {
- var isPrefetched = prefetched[this.getHref()];
+ var isPrefetched = prefetched[this.getPaths()[0]];
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners();
@@ -474,12 +476,18 @@ class Link extends _react.Component {
// as per https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html
- prefetch() {
+ prefetch(options) {
+ if (options === void 0) {
+ options = {};
+ }
+
if (!this.p || false) return; // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref();
+ var [href, asPath] = this.getPaths();
- _router.default.prefetch(href);
+ _router.default.prefetch(href, asPath, {
+ priority: options.priority
+ });
prefetched[href] = true;
}
@@ -515,7 +523,9 @@ class Link extends _react.Component {
child.props.onMouseEnter(e);
}
- this.prefetch();
+ this.prefetch({
+ priority: true
+ });
},
onClick: e => {
if (child.props && typeof child.props.onClick === 'function') {
Diff for link.js
@@ -388,6 +388,8 @@ module.exports = _possibleConstructorReturn;
"use strict";
+var _slicedToArray = __webpack_require__("8+Nu");
+
var _classCallCheck = __webpack_require__("/HRN");
var _createClass = __webpack_require__("WaGi");
@@ -575,21 +577,23 @@ function (_react$Component) {
this.cleanUpListeners();
}
}, {
- key: "getHref",
- value: function getHref() {
+ key: "getPaths",
+ value: function getPaths() {
var pathname = window.location.pathname;
var _this$formatUrls2 = this.formatUrls(this.props.href, this.props.as),
- parsedHref = _this$formatUrls2.href;
+ parsedHref = _this$formatUrls2.href,
+ parsedAs = _this$formatUrls2.as;
- return (0, _url.resolve)(pathname, parsedHref);
+ var resolvedHref = (0, _url.resolve)(pathname, parsedHref);
+ return [resolvedHref, parsedAs ? (0, _url.resolve)(pathname, parsedAs) : resolvedHref];
}
}, {
key: "handleRef",
value: function handleRef(ref) {
var _this2 = this;
- var isPrefetched = prefetched[this.getHref()];
+ var isPrefetched = prefetched[this.getPaths()[0]];
if (this.p && IntersectionObserver && ref && ref.tagName) {
this.cleanUpListeners();
@@ -605,12 +609,21 @@ function (_react$Component) {
}, {
key: "prefetch",
- value: function prefetch() {
+ value: function prefetch(options) {
+ if (options === void 0) {
+ options = {};
+ }
+
if (!this.p || false) return; // Prefetch the JSON page if asked (only in the client)
- var href = this.getHref();
+ var _this$getPaths = this.getPaths(),
+ _this$getPaths2 = _slicedToArray(_this$getPaths, 2),
+ href = _this$getPaths2[0],
+ asPath = _this$getPaths2[1];
- _router["default"].prefetch(href);
+ _router["default"].prefetch(href, asPath, {
+ priority: options.priority
+ });
prefetched[href] = true;
}
@@ -648,7 +661,9 @@ function (_react$Component) {
child.props.onMouseEnter(e);
}
- _this3.prefetch();
+ _this3.prefetch({
+ priority: true
+ });
},
onClick: function onClick(e) {
if (child.props && typeof child.props.onClick === 'function') {
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.8d696bd78889f5a6eddd.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.7abe18749252b8c9ffa2.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.8d696bd78889f5a6eddd.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-fd4cfd4ad6331437f961.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.74ddaa6612e291efaf38.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.be5d876e90bac8b6b657.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-88859e083a3b7e2866f5.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-9e977168bc55d5cb0d4e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.8d696bd78889f5a6eddd.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-355bc4b3077ea9d3fc7a.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.c07ba8a3b0945b0f6315.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/commons.5d483f979b96e9afed5a.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.9a0caf742c992a927903.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.7abe18749252b8c9ffa2.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.8d696bd78889f5a6eddd.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-fd4cfd4ad6331437f961.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-67c1cf0fd25ab032bf55.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 13s | 13.1s | |
nodeModulesSize | 52.7 MB | 52.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.14 kB | 5.23 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..54d3.js gzip | 4.68 kB | 4.68 kB | ✓ |
commons.HASH.js gzip | 4.06 kB | 4.06 kB | ✓ |
de003c3a9d30..4e43.js gzip | 16.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..420e.js gzip | N/A | 16.3 kB | N/A |
Overall change | 70 kB | 70.1 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.14 kB | 4.23 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
4952ddcd88e7..dule.js gzip | 5.56 kB | 5.56 kB | ✓ |
de003c3a9d30..dule.js gzip | 15.1 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 15.1 kB | N/A |
Overall change | 64.7 kB | 64.8 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 4.76 kB | 4.76 kB | ✓ |
Overall change | 4.76 kB | 4.76 kB | ✓ |
Client Pages Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.15 kB | 1.15 kB | ✓ |
_error.js gzip | 4.07 kB | 4.07 kB | ✓ |
hooks.js gzip | 779 B | 779 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 2.89 kB | 2.96 kB | |
routerDirect.js gzip | 283 B | 283 B | ✓ |
withRouter.js gzip | 282 B | 282 B | ✓ |
Overall change | 9.68 kB | 9.74 kB |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 576 B | 576 B | ✓ |
_error.module.js gzip | 3.06 kB | 3.06 kB | ✓ |
hooks.module.js gzip | 371 B | 371 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 2.46 kB | 2.51 kB | |
routerDirect..dule.js gzip | 273 B | 273 B | ✓ |
withRouter.m..dule.js gzip | 272 B | 272 B | ✓ |
Overall change | 7.22 kB | 7.27 kB |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 290 kB | 290 kB | |
404.html gzip | 1.45 kB | 1.46 kB | |
hooks.html gzip | 1.08 kB | 1.09 kB | |
index.js gzip | 289 kB | 290 kB | |
link.js gzip | 319 kB | 319 kB | |
routerDirect.js gzip | 317 kB | 316 kB | -130 B |
withRouter.js gzip | 317 kB | 316 kB | -320 B |
Overall change | 1.53 MB | 1.53 MB |
Commit: 825ee1a
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 8.4s | 8.9s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.74 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.75 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 924 B | 935 B | |
link.html gzip | 934 B | 945 B | |
withRouter.html gzip | 923 B | 933 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-44a1b629f1d6667155da.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-ee5249c53ec8bcc3de6d.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-44a1b629f1d6667155da.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-ea6988dc80a439c507ce.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-8f603ff7f69ed10904f6.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-ea6988dc80a439c507ce.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-44a1b629f1d6667155da.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-ee5249c53ec8bcc3de6d.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-44a1b629f1d6667155da.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-ea6988dc80a439c507ce.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-8f603ff7f69ed10904f6.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-ea6988dc80a439c507ce.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,74 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We handle warning for this case in development in the `<Link>`
+ // component directly.
+ }
+ }
+
+ var getHrefForSlug = path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && (_dataHref = isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : // Create `href` for normal (non-dynamic) data file
+ getHrefForSlug(route), // noop when we could not generate a data href
+ _dataHref) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1033,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1048,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,64 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this2 = this;
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We handle warning for this case in development in the `<Link>`
+ // component directly.
+ }
+ }
+
+ var getHrefForSlug = function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && (_dataHref = isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : // Create `href` for normal (non-dynamic) data file
+ getHrefForSlug(route), // noop when we could not generate a data href
+ _dataHref) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1187,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1196,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1211,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1225,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1233,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1250,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1267,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1206,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1296,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1226,15 +1305,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1341,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1361,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-44a1b629f1d6667155da.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-ee5249c53ec8bcc3de6d.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-44a1b629f1d6667155da.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-ea6988dc80a439c507ce.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-8f603ff7f69ed10904f6.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-ea6988dc80a439c507ce.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.3s | 9.4s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.74 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.75 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 292 kB | 292 kB | |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 963 B | 974 B | |
index.js gzip | 293 kB | 292 kB | -490 B |
link.js gzip | 299 kB | 300 kB | |
routerDirect.js gzip | 298 kB | 298 kB | -203 B |
withRouter.js gzip | 299 kB | 299 kB | |
Overall change | 1.48 MB | 1.48 MB |
Commit: 1c15762
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 8.2s | 8.5s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.74 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.75 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 936 B | |
link.html gzip | 935 B | 945 B | |
withRouter.html gzip | 923 B | 934 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-d9722a2adf1ac424c239.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-d9722a2adf1ac424c239.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,74 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We handle warning for this case in development in the `<Link>`
+ // component directly.
+ }
+ }
+
+ var getHrefForSlug = path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && (_dataHref = isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : // Create `href` for normal (non-dynamic) data file
+ getHrefForSlug(route), // noop when we could not generate a data href
+ _dataHref) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1033,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1048,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,64 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this2 = this;
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We handle warning for this case in development in the `<Link>`
+ // component directly.
+ }
+ }
+
+ var getHrefForSlug = function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && (_dataHref = isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : // Create `href` for normal (non-dynamic) data file
+ getHrefForSlug(route), // noop when we could not generate a data href
+ _dataHref) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1187,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1196,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1211,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1225,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1233,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1250,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1267,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1206,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1296,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1226,15 +1305,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1341,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1361,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-d9722a2adf1ac424c239.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 10.1s | 9.6s | -510ms |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.74 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.75 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 293 kB | 292 kB | -536 B |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 292 kB | 292 kB | |
link.js gzip | 299 kB | 299 kB | |
routerDirect.js gzip | 299 kB | 298 kB | -1.22 kB |
withRouter.js gzip | 298 kB | 299 kB | |
Overall change | 1.48 MB | 1.48 MB | -813 B |
Commit: c0772ce
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 8.6s | 8.9s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.74 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.75 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 936 B | |
link.html gzip | 935 B | 945 B | |
withRouter.html gzip | 923 B | 934 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-d9722a2adf1ac424c239.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,74 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We handle warning for this case in development in the `<Link>`
+ // component directly.
+ }
+ }
+
+ var getHrefForSlug = path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && (_dataHref = isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : // Create `href` for normal (non-dynamic) data file
+ getHrefForSlug(route), // noop when we could not generate a data href
+ _dataHref) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1033,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1048,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,64 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this2 = this;
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We handle warning for this case in development in the `<Link>`
+ // component directly.
+ }
+ }
+
+ var getHrefForSlug = function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && (_dataHref = isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : // Create `href` for normal (non-dynamic) data file
+ getHrefForSlug(route), // noop when we could not generate a data href
+ _dataHref) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1187,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this3 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1196,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this3.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this3.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1211,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this3.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1225,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1233,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this3.loadingRoutes[route]) {
+ _this3.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this3.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this3.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1250,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this3.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1267,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this4 = this;
var script = document.createElement('script');
@@ -1206,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this4.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1296,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this5 = this;
var register = function register() {
try {
@@ -1226,15 +1305,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this5.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this5.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this5.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this6 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1341,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1361,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this6.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-d9722a2adf1ac424c239.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-d9722a2adf1ac424c239.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-d8f1238a0ae89abf01ff.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.8s | 10.1s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.74 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.75 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 292 kB | 292 kB | |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 293 kB | 292 kB | -694 B |
link.js gzip | 300 kB | 299 kB | -774 B |
routerDirect.js gzip | 298 kB | 298 kB | |
withRouter.js gzip | 298 kB | 298 kB | -7 B |
Overall change | 1.48 MB | 1.48 MB | -1.25 kB |
Commit: fffeb50
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.2s | 9.7s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 10.1s | 10.6s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 293 kB | 292 kB | -1.09 kB |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 292 kB | 292 kB | |
link.js gzip | 300 kB | 299 kB | -666 B |
routerDirect.js gzip | 298 kB | 298 kB | -296 B |
withRouter.js gzip | 298 kB | 298 kB | |
Overall change | 1.48 MB | 1.48 MB | -1.35 kB |
Commit: e799bf3
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 8.5s | 8.5s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.5s | 9.2s | -260ms |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 292 kB | 292 kB | -675 B |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 293 kB | 292 kB | -901 B |
link.js gzip | 300 kB | 300 kB | -149 B |
routerDirect.js gzip | 299 kB | 298 kB | -1.09 kB |
withRouter.js gzip | 298 kB | 298 kB | -317 B |
Overall change | 1.48 MB | 1.48 MB | -3.11 kB |
Commit: 2ba0b8a
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.2s | 9.8s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 10.1s | 10.3s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 292 kB | 292 kB | |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 293 kB | 292 kB | -745 B |
link.js gzip | 299 kB | 299 kB | -69 B |
routerDirect.js gzip | 298 kB | 298 kB | -139 B |
withRouter.js gzip | 299 kB | 298 kB | -685 B |
Overall change | 1.48 MB | 1.48 MB | -1.53 kB |
Commit: 936bb98
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 10.8s | 11.2s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.9s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 293 kB | 292 kB | -834 B |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 293 kB | 292 kB | -1.05 kB |
link.js gzip | 299 kB | 299 kB | |
routerDirect.js gzip | 299 kB | 298 kB | -1.11 kB |
withRouter.js gzip | 298 kB | 298 kB | |
Overall change | 1.48 MB | 1.48 MB | -2.65 kB |
Commit: 939e8be
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 7.9s | 7.8s | -59ms |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 8.5s | 8.8s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 292 kB | 292 kB | |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 293 kB | 293 kB | |
link.js gzip | 300 kB | 300 kB | |
routerDirect.js gzip | 298 kB | 299 kB | |
withRouter.js gzip | 299 kB | 298 kB | -971 B |
Overall change | 1.48 MB | 1.48 MB |
Commit: bd3f208
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.2s | 8.9s | -272ms |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.8s | 10.1s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall decrease ✓
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 292 kB | 292 kB | -88 B |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 292 kB | 292 kB | |
link.js gzip | 300 kB | 299 kB | -611 B |
routerDirect.js gzip | 299 kB | 298 kB | -1.22 kB |
withRouter.js gzip | 299 kB | 298 kB | -756 B |
Overall change | 1.48 MB | 1.48 MB | -2.51 kB |
Commit: bd3f208
@@ -851,6 +853,11 @@ export default async function build(dir: string, conf = null): Promise<void> { | |||
JSON.stringify(prerenderManifest), | |||
'utf8' | |||
) | |||
await generateClientSsgManifest(prerenderManifest, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't this be part of the buildManifest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally separated them so we didn’t unnecessarily increase the size of either file (since the build manifest blocks navigation).
Also, their generation is different. The build manifest can be computed at build time but the SSG manifest must be post build after we require all the pages in jest-worker
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM 🎉
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 9.9s | 9.6s | -278ms |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | 6.64 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
index.html gzip | 925 B | 935 B | |
link.html gzip | 935 B | 943 B | |
withRouter.html gzip | 923 B | 931 B | |
Overall change | 2.78 kB | 2.81 kB |
Diffs
Diff for link.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/link.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div><h3>A Link page!</h3><a href="/">Go to /</a></div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/link","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/link" src="/_next/static/BUILD_ID/pages/link.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for index.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/index.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next">Hello world 👋</div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/" src="/_next/static/BUILD_ID/pages/index.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Diff for main-HASH.module.js
@@ -768,8 +768,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports.default = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -783,6 +791,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -826,12 +835,89 @@ class PageLoader {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(resolve => {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = () => {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
getDependencies(route) {
return this.promisedBuildManifest.then(man => man[route] && man[route].map(url => this.assetPrefix + "/_next/" + encodeURI(url)) || []);
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ getDataHref(href, asPath) {
+ var getHrefForSlug =
+ /** @type string */
+ path => this.assetPrefix + "/_next/data/" + this.buildId + (path === '/' ? '/index' : path) + ".json";
+
+ var {
+ pathname: hrefPathname,
+ query
+ } = (0, _url.parse)(href, true);
+ var {
+ pathname: asPathname
+ } = (0, _url.parse)(asPath);
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(param => {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+
+ prefetchData(href, asPath) {
+ var {
+ pathname: hrefPathname
+ } = (0, _url.parse)(href, true);
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then((s, _dataHref) => // Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = this.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch'));
+ }
loadPage(route) {
return this.loadPageScript(route).then(v => v.page);
@@ -962,6 +1048,11 @@ class PageLoader {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
prefetch(route, isDependency) {
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
@@ -972,6 +1063,8 @@ class PageLoader {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
Diff for main-HASH.js
@@ -1024,8 +1024,16 @@ var _interopRequireDefault = __webpack_require__("TqRt");
exports.__esModule = true;
exports["default"] = void 0;
+var _url = __webpack_require__("QmWs");
+
var _mitt = _interopRequireDefault(__webpack_require__("dZ6Y"));
+var _isDynamic = __webpack_require__("/jkW");
+
+var _routeMatcher = __webpack_require__("gguc");
+
+var _routeRegex = __webpack_require__("YTqd");
+
function hasRel(rel, link) {
try {
link = document.createElement('link');
@@ -1039,6 +1047,7 @@ var relPrefetch = hasRel('preload') && !hasRel('prefetch') ? // https://caniuse.
// IE 11, Edge 12+, nearly all evergreen
'prefetch';
var hasNoModule = 'noModule' in document.createElement('script');
+/** @param {string} route */
function normalizeRoute(route) {
if (route[0] !== '/') {
@@ -1084,6 +1093,18 @@ var PageLoader = /*#__PURE__*/function () {
}
});
}
+ /** @type {Promise<Set<string>>} */
+
+
+ this.promisedSsgManifest = new Promise(function (resolve) {
+ if (window.__SSG_MANIFEST) {
+ resolve(window.__SSG_MANIFEST);
+ } else {
+ window.__SSG_MANIFEST_CB = function () {
+ resolve(window.__SSG_MANIFEST);
+ };
+ }
+ });
} // Returns a promise for the dependencies for a particular route
@@ -1098,6 +1119,82 @@ var PageLoader = /*#__PURE__*/function () {
}) || [];
});
}
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "getDataHref",
+ value: function getDataHref(href, asPath) {
+ var _this2 = this;
+
+ var getHrefForSlug =
+ /** @type string */
+ function getHrefForSlug(path) {
+ return _this2.assetPrefix + "/_next/data/" + _this2.buildId + (path === '/' ? '/index' : path) + ".json";
+ };
+
+ var _ref = (0, _url.parse)(href, true),
+ hrefPathname = _ref.pathname,
+ query = _ref.query;
+
+ var _ref2 = (0, _url.parse)(asPath),
+ asPathname = _ref2.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
+ interpolatedRoute;
+
+ if (isDynamic) {
+ var dynamicRegex = (0, _routeRegex.getRouteRegex)(route);
+ var dynamicGroups = dynamicRegex.groups;
+ var dynamicMatches = // Try to match the dynamic route against the asPath
+ (0, _routeMatcher.getRouteMatcher)(dynamicRegex)(asPathname) || // Fall back to reading the values from the href
+ // TODO: should this take priority; also need to change in the router.
+ query;
+ interpolatedRoute = route;
+
+ if (!Object.keys(dynamicGroups).every(function (param) {
+ var value = dynamicMatches[param];
+ var repeat = dynamicGroups[param].repeat; // support single-level catch-all
+ // TODO: more robust handling for user-error (passing `/`)
+
+ if (repeat && !Array.isArray(value)) value = [value];
+ return param in dynamicMatches && ( // Interpolate group into data URL if present
+ interpolatedRoute = interpolatedRoute.replace("[" + (repeat ? '...' : '') + param + "]", repeat ? value.map(encodeURIComponent).join('/') : encodeURIComponent(value)));
+ })) {
+ interpolatedRoute = ''; // did not satisfy all requirements
+ // n.b. We ignore this error because we handle warning for this case in
+ // development in the `<Link>` component directly.
+ }
+ }
+
+ return isDynamic ? interpolatedRoute && getHrefForSlug(interpolatedRoute) : getHrefForSlug(route);
+ }
+ /**
+ * @param {string} href the route href (file-system path)
+ * @param {string} asPath the URL as shown in browser (virtual path); used for dynamic routes
+ */
+
+ }, {
+ key: "prefetchData",
+ value: function prefetchData(href, asPath) {
+ var _this3 = this;
+
+ var _ref3 = (0, _url.parse)(href, true),
+ hrefPathname = _ref3.pathname;
+
+ var route = normalizeRoute(hrefPathname);
+ return this.promisedSsgManifest.then(function (s, _dataHref) {
+ return (// Check if the route requires a data file
+ s.has(route) && ( // Try to generate data href, noop when falsy
+ _dataHref = _this3.getDataHref(href, asPath)) && // noop when data has already been prefetched (dedupe)
+ !document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + _dataHref + "\"]") && // Inject the `<link rel=prefetch>` tag for above computed `href`.
+ appendLink(_dataHref, relPrefetch, 'fetch')
+ );
+ });
+ }
}, {
key: "loadPage",
value: function loadPage(route) {
@@ -1108,7 +1205,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadPageScript",
value: function loadPageScript(route) {
- var _this2 = this;
+ var _this4 = this;
route = normalizeRoute(route);
return new Promise(function (resolve, reject) {
@@ -1117,9 +1214,9 @@ var PageLoader = /*#__PURE__*/function () {
page = _ref.page,
mod = _ref.mod;
- _this2.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this2.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1132,7 +1229,7 @@ var PageLoader = /*#__PURE__*/function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this2.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1146,7 +1243,7 @@ var PageLoader = /*#__PURE__*/function () {
} // Register a listener to get the page
- _this2.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1154,14 +1251,14 @@ var PageLoader = /*#__PURE__*/function () {
return;
}
- if (!_this2.loadingRoutes[route]) {
- _this2.loadingRoutes[route] = true;
+ if (!_this4.loadingRoutes[route]) {
+ _this4.loadingRoutes[route] = true;
if (true) {
- _this2.getDependencies(route).then(function (deps) {
+ _this4.getDependencies(route).then(function (deps) {
deps.forEach(function (d) {
if (/\.js$/.test(d) && !document.querySelector("script[src^=\"" + d + "\"]")) {
- _this2.loadScript(d, route, false);
+ _this4.loadScript(d, route, false);
}
if (/\.css$/.test(d) && !document.querySelector("link[rel=stylesheet][href^=\"" + d + "\"]")) {
@@ -1171,7 +1268,7 @@ var PageLoader = /*#__PURE__*/function () {
}
});
- _this2.loadRoute(route);
+ _this4.loadRoute(route);
});
} else {}
}
@@ -1188,7 +1285,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this3 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1206,7 +1303,7 @@ var PageLoader = /*#__PURE__*/function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this3.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1217,7 +1314,7 @@ var PageLoader = /*#__PURE__*/function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this4 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1226,15 +1323,15 @@ var PageLoader = /*#__PURE__*/function () {
page: mod["default"] || mod,
mod: mod
};
- _this4.pageCache[route] = pageData;
+ _this6.pageCache[route] = pageData;
- _this4.pageRegisterEvents.emit(route, pageData);
+ _this6.pageRegisterEvents.emit(route, pageData);
} catch (error) {
- _this4.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this4.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1244,10 +1341,15 @@ var PageLoader = /*#__PURE__*/function () {
register();
}
+ /**
+ * @param {string} route
+ * @param {boolean} [isDependency]
+ */
+
}, {
key: "prefetch",
value: function prefetch(route, isDependency) {
- var _this5 = this;
+ var _this7 = this;
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
// License: Apache 2.0
@@ -1257,6 +1359,8 @@ var PageLoader = /*#__PURE__*/function () {
// Don't prefetch if using 2G or if Save-Data is enabled.
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
}
+ /** @type {string} */
+
var url;
@@ -1275,7 +1379,7 @@ var PageLoader = /*#__PURE__*/function () {
return Promise.all(document.querySelector("link[rel=\"" + relPrefetch + "\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]") ? [] : [appendLink(url, relPrefetch, url.match(/\.css$/) ? 'style' : 'script'), true && !isDependency && this.getDependencies(route).then(function (urls) {
return Promise.all(urls.map(function (url) {
- return _this5.prefetch(url, true);
+ return _this7.prefetch(url, true);
}));
})]).then( // do not return any data
function () {}, // swallow prefetch errors
Diff for de003c3a9d30..06f6c44cd.js
@@ -1022,7 +1022,7 @@ var Router = /*#__PURE__*/function () {
if (false) {}
- _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(function () {
+ Promise.all([_this4.pageLoader.prefetchData(url, asPath), _this4.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(function () {
return resolve();
}, reject);
});
Diff for de003c3a9d30..cf.module.js
@@ -922,7 +922,7 @@ class Router {
if (false) {}
- this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname)).then(() => resolve(), reject);
+ Promise.all([this.pageLoader.prefetchData(url, asPath), this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](toRoute(pathname))]).then(() => resolve(), reject);
});
}
Diff for withRouter.html
@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.aca3489c7aa06f6c44cd.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.41cad24c1ccd64f4ebcf.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-10c99223e8137d2f2882.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-42f4f2dea1582c6de82d.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
+<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/BUILD_ID/pages/withRouter.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/BUILD_ID/pages/_app.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" as="script" crossorigin="anonymous"/><link rel="preload" href="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" as="script" crossorigin="anonymous"/></head><body><div id="__next"><div>I use withRouter</div></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{"props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"BUILD_ID","isFallback":false}</script><script crossorigin="anonymous" nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" nomodule="" src="/_next/static/runtime/polyfills-1ac1d7fc1d59311e5a47.js"></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/withRouter" src="/_next/static/BUILD_ID/pages/withRouter.module.js" crossorigin="anonymous" type="module"></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.js" crossorigin="anonymous" nomodule=""></script><script async="" data-next-page="/_app" src="/_next/static/BUILD_ID/pages/_app.module.js" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/webpack-4d739ac7b0d8f888ab18.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/webpack-d629b83a65f3e33fa99e.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/framework.5bb7f30f859f5f31359f.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.77e5ebfafaef1fc2d092.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.058e0f35b49912f4bbfb.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/runtime/main-beec2f5bc393e2ec3b64.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/runtime/main-cc8665bf6905296326b7.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_buildManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_buildManifest.module.js" async="" crossorigin="anonymous" type="module"></script><script src="/_next/static/BUILD_ID/_ssgManifest.js" async="" crossorigin="anonymous" nomodule=""></script><script src="/_next/static/BUILD_ID/_ssgManifest.module.js" async="" crossorigin="anonymous" type="module"></script></body></html>
\ No newline at end of file
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
buildDuration | 10.1s | 10.2s | |
nodeModulesSize | 56.3 MB | 56.3 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.js gzip | 5.41 kB | 5.76 kB | |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..7030.js gzip | 9.68 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..67cb.js gzip | N/A | 9.69 kB | N/A |
Overall change | 55 kB | 55.3 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
main-HASH.module.js gzip | 4.44 kB | 4.78 kB | |
webpack-HASH..dule.js gzip | 746 B | 746 B | ✓ |
de003c3a9d30..dule.js gzip | 6.63 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
de003c3a9d30..dule.js gzip | N/A | 6.64 kB | N/A |
Overall change | 51 kB | 51.3 kB |
Legacy Client Bundles (polyfills)
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 18.9 kB | 18.9 kB | ✓ |
Overall change | 18.9 kB | 18.9 kB | ✓ |
Client Pages
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.js gzip | 1.07 kB | 1.07 kB | ✓ |
_error.js gzip | 2.98 kB | 2.98 kB | ✓ |
hooks.js gzip | 664 B | 664 B | ✓ |
index.js gzip | 222 B | 222 B | ✓ |
link.js gzip | 1.89 kB | 1.89 kB | ✓ |
routerDirect.js gzip | 279 B | 279 B | ✓ |
withRouter.js gzip | 278 B | 278 B | ✓ |
Overall change | 7.38 kB | 7.38 kB | ✓ |
Client Pages Modern
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_app.module.js gzip | 589 B | 589 B | ✓ |
_error.module.js gzip | 2.08 kB | 2.08 kB | ✓ |
hooks.module.js gzip | 370 B | 370 B | ✓ |
index.module.js gzip | 212 B | 212 B | ✓ |
link.module.js gzip | 1.48 kB | 1.48 kB | ✓ |
routerDirect..dule.js gzip | 271 B | 271 B | ✓ |
withRouter.m..dule.js gzip | 270 B | 270 B | ✓ |
Overall change | 5.27 kB | 5.27 kB | ✓ |
Client Build Manifests
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_buildManifest.js gzip | 61 B | 61 B | ✓ |
_buildManife..dule.js gzip | 61 B | 61 B | ✓ |
Overall change | 122 B | 122 B | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | Timer/next.js enhancement/prefetch-ssg-data | Change | |
---|---|---|---|
_error.js gzip | 293 kB | 292 kB | -458 B |
404.html gzip | 1.33 kB | 1.34 kB | |
hooks.html gzip | 964 B | 975 B | |
index.js gzip | 293 kB | 293 kB | -109 B |
link.js gzip | 299 kB | 299 kB | -22 B |
routerDirect.js gzip | 298 kB | 299 kB | |
withRouter.js gzip | 298 kB | 298 kB | -240 B |
Overall change | 1.48 MB | 1.48 MB |
Commit: 6ead1b4
This pull request prefetches static data as low-priority to ensure it's ready by navigation-time.