Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade web-vitals #17028

Merged
merged 1 commit into from
Sep 12, 2020
Merged

Upgrade web-vitals #17028

merged 1 commit into from
Sep 12, 2020

Conversation

omBratteng
Copy link
Contributor

ref GoogleChrome/web-vitals#68

won't fail the new no-unload-listeners Lighthouse audit.

@ijjk
Copy link
Member

ijjk commented Sep 11, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
buildDuration 10.1s 10s -100ms
nodeModulesSize 60 MB 60 MB ⚠️ +3.15 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
/ failed reqs 0 0
/ total time (seconds) 2.005 1.975 -0.03
/ avg req/sec 1247.02 1265.66 +18.64
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.039 1.078 ⚠️ +0.04
/error-in-render avg req/sec 2406.55 2319.41 ⚠️ -87.14
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
677f882d2ed8..9339.js gzip 10.9 kB 10.9 kB
framework.HASH.js gzip 39 kB 39 kB
main-62ff67c..d780.js gzip 7 kB 7.02 kB ⚠️ +21 B
webpack-e067..f178.js gzip 751 B 751 B
Overall change 57.6 kB 57.6 kB ⚠️ +21 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
677f882d2ed8..dule.js gzip 6.77 kB 6.77 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-3856c6c..dule.js gzip 6.07 kB 6.09 kB ⚠️ +25 B
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 52.6 kB 52.6 kB ⚠️ +25 B
Legacy Client Bundles (polyfills)
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-ed1b0..8fbd.js gzip 3.44 kB 3.44 kB
hooks-89731c..c609.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d2344ce..8b36.js gzip 1.3 kB 1.3 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.71 kB 7.71 kB
Client Pages Modern
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-4469a..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-f8c0daf..dule.js gzip 1.26 kB 1.26 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_buildManifest.js gzip 322 B 322 B
_buildManife..dule.js gzip 329 B 329 B
Overall change 651 B 651 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
index.html gzip 1 kB 1 kB -1 B
link.html gzip 1.01 kB 1.01 kB -1 B
withRouter.html gzip 996 B 995 B -1 B
Overall change 3.01 kB 3.01 kB -3 B

Diffs

Diff for main-4cff6df..9f93a3cb6.js
@@ -1269,14 +1269,14 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         __webpack_exports__,
         "getFCP",
         function() {
-          return m;
+          return v;
         }
       );
       /* harmony export (binding) */ __webpack_require__.d(
         __webpack_exports__,
         "getFID",
         function() {
-          return v;
+          return f;
         }
       );
       /* harmony export (binding) */ __webpack_require__.d(
@@ -1329,7 +1329,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         },
         u = function() {
           addEventListener("pagehide", s),
-            addEventListener("unload", function() {});
+            addEventListener("beforeunload", function() {});
         },
         c = function(t) {
           var n =
@@ -1357,19 +1357,20 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
           };
         },
         p = function(t) {
-          var n =
-              arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
-            e = i("CLS", 0),
-            r = function(t) {
+          var n,
+            e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+            r = i("CLS", 0),
+            o = function(t) {
               t.hadRecentInput ||
-                ((e.value += t.value), e.entries.push(t), s());
+                ((r.value += t.value), r.entries.push(t), n());
             },
-            o = a("layout-shift", r),
-            s = l(t, e, o, n);
-          c(function(t) {
-            var n = t.isUnloading;
-            o && o.takeRecords().map(r), n && (e.isFinal = !0), s();
-          });
+            s = a("layout-shift", o);
+          s &&
+            ((n = l(t, r, s, e)),
+            c(function(t) {
+              var e = t.isUnloading;
+              s.takeRecords().map(o), e && (r.isFinal = !0), n();
+            }));
         },
         d = function() {
           return (
@@ -1386,20 +1387,21 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
             }
           );
         },
-        m = function(t) {
-          var n = i("FCP"),
-            e = d(),
-            r = a("paint", function(t) {
+        v = function(t) {
+          var n,
+            e = i("FCP"),
+            r = d(),
+            o = a("paint", function(t) {
               "first-contentful-paint" === t.name &&
-                t.startTime < e.timeStamp &&
-                ((n.value = t.startTime),
-                (n.isFinal = !0),
-                n.entries.push(t),
-                o());
-            }),
-            o = l(t, n, r);
+                t.startTime < r.timeStamp &&
+                ((e.value = t.startTime),
+                (e.isFinal = !0),
+                e.entries.push(t),
+                n());
+            });
+          o && (n = l(t, e, o));
         },
-        v = function(t) {
+        f = function(t) {
           var n = i("FID"),
             e = d(),
             r = function(t) {
@@ -1411,30 +1413,30 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
             },
             o = a("first-input", r),
             s = l(t, n, o);
-          c(function() {
-            o && (o.takeRecords().map(r), o.disconnect());
-          }, !0),
-            o ||
-              (window.perfMetrics &&
-                window.perfMetrics.onFirstInputDelay &&
-                window.perfMetrics.onFirstInputDelay(function(t, i) {
-                  i.timeStamp < e.timeStamp &&
-                    ((n.value = t),
-                    (n.isFinal = !0),
-                    (n.entries = [
-                      {
-                        entryType: "first-input",
-                        name: i.type,
-                        target: i.target,
-                        cancelable: i.cancelable,
-                        startTime: i.timeStamp,
-                        processingStart: i.timeStamp + t
-                      }
-                    ]),
-                    s());
-                }));
+          o
+            ? c(function() {
+                o.takeRecords().map(r), o.disconnect();
+              }, !0)
+            : window.perfMetrics &&
+              window.perfMetrics.onFirstInputDelay &&
+              window.perfMetrics.onFirstInputDelay(function(t, i) {
+                i.timeStamp < e.timeStamp &&
+                  ((n.value = t),
+                  (n.isFinal = !0),
+                  (n.entries = [
+                    {
+                      entryType: "first-input",
+                      name: i.type,
+                      target: i.target,
+                      cancelable: i.cancelable,
+                      startTime: i.timeStamp,
+                      processingStart: i.timeStamp + t
+                    }
+                  ]),
+                  s());
+              });
         },
-        f = function() {
+        m = function() {
           return (
             n ||
               (n = new Promise(function(t) {
@@ -1450,23 +1452,25 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
           );
         },
         g = function(t) {
-          var n =
-              arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
-            e = i("LCP"),
-            r = d(),
-            o = function(t) {
-              var n = t.startTime;
-              n < r.timeStamp
-                ? ((e.value = n), e.entries.push(t))
-                : (e.isFinal = !0),
-                u();
+          var n,
+            e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+            r = i("LCP"),
+            o = d(),
+            s = function(t) {
+              var e = t.startTime;
+              e < o.timeStamp
+                ? ((r.value = e), r.entries.push(t))
+                : (r.isFinal = !0),
+                n();
             },
-            s = a("largest-contentful-paint", o),
-            u = l(t, e, s, n),
-            p = function() {
-              e.isFinal || (s && s.takeRecords().map(o), (e.isFinal = !0), u());
+            u = a("largest-contentful-paint", s);
+          if (u) {
+            n = l(t, r, u, e);
+            var p = function() {
+              r.isFinal || (u.takeRecords().map(s), (r.isFinal = !0), n());
             };
-          f().then(p), c(p, !0);
+            m().then(p), c(p, !0);
+          }
         },
         h = function(t) {
           var n,
Diff for main-e17e61f..0b.module.js
@@ -940,14 +940,14 @@
         __webpack_exports__,
         "getFCP",
         function() {
-          return m;
+          return v;
         }
       );
       /* harmony export (binding) */ __webpack_require__.d(
         __webpack_exports__,
         "getFID",
         function() {
-          return v;
+          return f;
         }
       );
       /* harmony export (binding) */ __webpack_require__.d(
@@ -1000,7 +1000,7 @@
         },
         u = function() {
           addEventListener("pagehide", s),
-            addEventListener("unload", function() {});
+            addEventListener("beforeunload", function() {});
         },
         c = function(t) {
           var n =
@@ -1028,19 +1028,20 @@
           };
         },
         p = function(t) {
-          var n =
-              arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
-            e = i("CLS", 0),
-            r = function(t) {
+          var n,
+            e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+            r = i("CLS", 0),
+            o = function(t) {
               t.hadRecentInput ||
-                ((e.value += t.value), e.entries.push(t), s());
+                ((r.value += t.value), r.entries.push(t), n());
             },
-            o = a("layout-shift", r),
-            s = l(t, e, o, n);
-          c(function(t) {
-            var n = t.isUnloading;
-            o && o.takeRecords().map(r), n && (e.isFinal = !0), s();
-          });
+            s = a("layout-shift", o);
+          s &&
+            ((n = l(t, r, s, e)),
+            c(function(t) {
+              var e = t.isUnloading;
+              s.takeRecords().map(o), e && (r.isFinal = !0), n();
+            }));
         },
         d = function() {
           return (
@@ -1057,20 +1058,21 @@
             }
           );
         },
-        m = function(t) {
-          var n = i("FCP"),
-            e = d(),
-            r = a("paint", function(t) {
+        v = function(t) {
+          var n,
+            e = i("FCP"),
+            r = d(),
+            o = a("paint", function(t) {
               "first-contentful-paint" === t.name &&
-                t.startTime < e.timeStamp &&
-                ((n.value = t.startTime),
-                (n.isFinal = !0),
-                n.entries.push(t),
-                o());
-            }),
-            o = l(t, n, r);
+                t.startTime < r.timeStamp &&
+                ((e.value = t.startTime),
+                (e.isFinal = !0),
+                e.entries.push(t),
+                n());
+            });
+          o && (n = l(t, e, o));
         },
-        v = function(t) {
+        f = function(t) {
           var n = i("FID"),
             e = d(),
             r = function(t) {
@@ -1082,30 +1084,30 @@
             },
             o = a("first-input", r),
             s = l(t, n, o);
-          c(function() {
-            o && (o.takeRecords().map(r), o.disconnect());
-          }, !0),
-            o ||
-              (window.perfMetrics &&
-                window.perfMetrics.onFirstInputDelay &&
-                window.perfMetrics.onFirstInputDelay(function(t, i) {
-                  i.timeStamp < e.timeStamp &&
-                    ((n.value = t),
-                    (n.isFinal = !0),
-                    (n.entries = [
-                      {
-                        entryType: "first-input",
-                        name: i.type,
-                        target: i.target,
-                        cancelable: i.cancelable,
-                        startTime: i.timeStamp,
-                        processingStart: i.timeStamp + t
-                      }
-                    ]),
-                    s());
-                }));
+          o
+            ? c(function() {
+                o.takeRecords().map(r), o.disconnect();
+              }, !0)
+            : window.perfMetrics &&
+              window.perfMetrics.onFirstInputDelay &&
+              window.perfMetrics.onFirstInputDelay(function(t, i) {
+                i.timeStamp < e.timeStamp &&
+                  ((n.value = t),
+                  (n.isFinal = !0),
+                  (n.entries = [
+                    {
+                      entryType: "first-input",
+                      name: i.type,
+                      target: i.target,
+                      cancelable: i.cancelable,
+                      startTime: i.timeStamp,
+                      processingStart: i.timeStamp + t
+                    }
+                  ]),
+                  s());
+              });
         },
-        f = function() {
+        m = function() {
           return (
             n ||
               (n = new Promise(function(t) {
@@ -1121,23 +1123,25 @@
           );
         },
         g = function(t) {
-          var n =
-              arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
-            e = i("LCP"),
-            r = d(),
-            o = function(t) {
-              var n = t.startTime;
-              n < r.timeStamp
-                ? ((e.value = n), e.entries.push(t))
-                : (e.isFinal = !0),
-                u();
+          var n,
+            e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+            r = i("LCP"),
+            o = d(),
+            s = function(t) {
+              var e = t.startTime;
+              e < o.timeStamp
+                ? ((r.value = e), r.entries.push(t))
+                : (r.isFinal = !0),
+                n();
             },
-            s = a("largest-contentful-paint", o),
-            u = l(t, e, s, n),
-            p = function() {
-              e.isFinal || (s && s.takeRecords().map(o), (e.isFinal = !0), u());
+            u = a("largest-contentful-paint", s);
+          if (u) {
+            n = l(t, r, u, e);
+            var p = function() {
+              r.isFinal || (u.takeRecords().map(s), (r.isFinal = !0), n());
             };
-          f().then(p), c(p, !0);
+            m().then(p), c(p, !0);
+          }
         },
         h = function(t) {
           var n,
Diff for index.html
@@ -6,7 +6,7 @@
     <noscript data-n-css="true"></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e17e61f1528be9bbbf0b.module.js"
+      href="/_next/static/chunks/main-dcbdc5cc409054c41651.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -85,13 +85,13 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-4cff6df1ee19f93a3cb6.js"
+      src="/_next/static/chunks/main-122ce010eb18dfc7fd08.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e17e61f1528be9bbbf0b.module.js"
+      src="/_next/static/chunks/main-dcbdc5cc409054c41651.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -6,7 +6,7 @@
     <noscript data-n-css="true"></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e17e61f1528be9bbbf0b.module.js"
+      href="/_next/static/chunks/main-dcbdc5cc409054c41651.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -90,13 +90,13 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-4cff6df1ee19f93a3cb6.js"
+      src="/_next/static/chunks/main-122ce010eb18dfc7fd08.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e17e61f1528be9bbbf0b.module.js"
+      src="/_next/static/chunks/main-dcbdc5cc409054c41651.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -6,7 +6,7 @@
     <noscript data-n-css="true"></noscript>
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e17e61f1528be9bbbf0b.module.js"
+      href="/_next/static/chunks/main-dcbdc5cc409054c41651.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -85,13 +85,13 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-4cff6df1ee19f93a3cb6.js"
+      src="/_next/static/chunks/main-122ce010eb18dfc7fd08.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e17e61f1528be9bbbf0b.module.js"
+      src="/_next/static/chunks/main-dcbdc5cc409054c41651.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
buildDuration 11.6s 11.7s ⚠️ +56ms
nodeModulesSize 60 MB 60 MB ⚠️ +3.15 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
677f882d2ed8..9339.js gzip 10.9 kB 10.9 kB
framework.HASH.js gzip 39 kB 39 kB
main-62ff67c..d780.js gzip 7 kB N/A N/A
webpack-e067..f178.js gzip 751 B 751 B
main-74c380c..b030.js gzip N/A 7.02 kB N/A
Overall change 57.6 kB 57.6 kB ⚠️ +21 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
677f882d2ed8..dule.js gzip 6.77 kB 6.77 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-3856c6c..dule.js gzip 6.07 kB N/A N/A
webpack-07c5..dule.js gzip 751 B 751 B
main-d26f6fe..dule.js gzip N/A 6.09 kB N/A
Overall change 52.6 kB 52.6 kB ⚠️ +25 B
Legacy Client Bundles (polyfills)
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-ed1b0..8fbd.js gzip 3.44 kB 3.44 kB
hooks-89731c..c609.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d2344ce..8b36.js gzip 1.3 kB 1.3 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.71 kB 7.71 kB
Client Pages Modern
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-4469a..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-f8c0daf..dule.js gzip 1.26 kB 1.26 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_buildManifest.js gzip 322 B 322 B
_buildManife..dule.js gzip 329 B 329 B
Overall change 651 B 651 B
Serverless bundles
vercel/next.js canary omBratteng/next.js upgrade-web-vitals Change
_error.js 1.03 MB 1.03 MB
404.html 4.34 kB 4.34 kB
hooks.html 3.92 kB 3.92 kB
index.js 1.03 MB 1.03 MB
link.js 1.08 MB 1.08 MB
routerDirect.js 1.07 MB 1.07 MB
withRouter.js 1.07 MB 1.07 MB
Overall change 5.31 MB 5.31 MB
Commit: 9150056

Copy link
Member

@Timer Timer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kodiakhq kodiakhq bot merged commit 5f36f46 into vercel:canary Sep 12, 2020
@omBratteng omBratteng deleted the upgrade-web-vitals branch September 12, 2020 07:26
HitoriSensei pushed a commit to HitoriSensei/next.js that referenced this pull request Sep 26, 2020
ref GoogleChrome/web-vitals#68

won't fail the new [`no-unload-listeners`](GoogleChrome/lighthouse#11085) Lighthouse audit.
@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants