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

Fix pages/index.js and pages/index/index.js behavior #13699

Merged
merged 20 commits into from
Jun 4, 2020

Conversation

Janpot
Copy link
Contributor

@Janpot Janpot commented Jun 3, 2020

Disambiguate between pages/index.js and pages/index/index.js so that they resolve differently.
It all started with a bug in pagesmanifest that propagated throughout the codebase. After fixing pagesmanifest I was able to remove a few hacks here and there and more logic is shared now. especially the logic that resolves an entrypoint back into a route path. To sum up what happened:

  • getRouteFromEntrypoint is the inverse operation of getPageFile that's under pages/_document.tsx
  • denormalizePagePath is the inverse operation of normalizePagePath.

Everything is refactored in terms of these operations, that makes their behavior uniform and easier to update/patch in a central place. Before there were subtle differences between those that made index/index.js hard to handle.

Some potential follow up on this PR:

  • hot-reloader still has one place that does very similar behavior to getRouteFromEntrypoint. It can probably be rewritten in terms of getRouteFromEntrypoint.

  • There are a few places where denormalizePagePath(normalizePagePath(...)) is happening. This is a sign that normalizePagePath is doing some validation that is independent of its rewriting logic. That should probably be factored out in its own function. after that I should probably investigate whether normalizePagePath is even still needed at all.

  • a lot of code is doing .replace(/\\/g, ''). If wanted, that could be replaced with normalizePathSep.

  • It looks to me like some logic that's spread across the project can be centralized in 4 functions

    • getRouteFromEntrypoint (part of this PR)
    • its inverse getEntrypointFromRoute (already exists in _document.tsx as getPageFile)
    • getRouteFromPageFile
    • its inverse getPageFileFromRoute (already exists as findPageFile in server/lib/find-page-file.ts)

    It could be beneficial to structure the code to keep these fuctionalities close together and name them similarly.

  • revise index.amp handling in pagesmanifest. I left it alone in this PR to keep it scoped, but it may be broken wrt nested index files as well. It might even make sense to reshape the pagesmanifest altogether to handle html/json/amp/... better

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.1s 11.9s -152ms
nodeModulesSize 66 MB 66 MB -330 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.114 2.191 ⚠️ +0.08
/ avg req/sec 1182.34 1140.91 -41.43
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.448 1.28 -0.17
/error-in-render avg req/sec 1726.09 1952.54 ⚠️ +226.45
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 924 B
link.html gzip 934 B 934 B
withRouter.html gzip 922 B 922 B
Overall change 2.78 kB 2.78 kB

Diffs

Diff for main-HASH.js
@@ -1464,7 +1464,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for main-HASH.module.js
@@ -1107,7 +1107,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.1s 12.7s -410ms
nodeModulesSize 66 MB 66 MB -330 B
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 879 kB ⚠️ +108 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 879 kB ⚠️ +108 B
link.js 916 kB 917 kB ⚠️ +108 B
routerDirect.js 909 kB 909 kB ⚠️ +108 B
withRouter.js 909 kB 909 kB ⚠️ +108 B
Overall change 4.5 MB 4.5 MB ⚠️ +540 B

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.3s 12.3s ⚠️ +17ms
nodeModulesSize 66 MB 66 MB -649 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.081 2.056 -0.02
/ avg req/sec 1201.28 1216.2 ⚠️ +14.92
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.192 1.214 ⚠️ +0.02
/error-in-render avg req/sec 2097.52 2058.7 -38.82
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 924 B
link.html gzip 934 B 934 B
withRouter.html gzip 922 B 922 B
Overall change 2.78 kB 2.78 kB

Diffs

Diff for main-HASH.js
@@ -1464,7 +1464,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for main-HASH.module.js
@@ -1107,7 +1107,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.4s 13.3s -113ms
nodeModulesSize 66 MB 66 MB -649 B
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 879 kB ⚠️ +108 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 879 kB ⚠️ +108 B
link.js 916 kB 917 kB ⚠️ +108 B
routerDirect.js 909 kB 909 kB ⚠️ +108 B
withRouter.js 909 kB 909 kB ⚠️ +108 B
Overall change 4.5 MB 4.5 MB ⚠️ +540 B

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.7s 13.6s -146ms
nodeModulesSize 66 MB 66 MB -1.27 kB
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.416 2.359 -0.06
/ avg req/sec 1034.56 1059.95 ⚠️ +25.39
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.567 1.522 -0.04
/error-in-render avg req/sec 1595.27 1642.67 ⚠️ +47.4
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 924 B
link.html gzip 934 B 934 B
withRouter.html gzip 922 B 922 B
Overall change 2.78 kB 2.78 kB

Diffs

Diff for main-HASH.js
@@ -1464,7 +1464,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for main-HASH.module.js
@@ -1107,7 +1107,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 14.4s 14.5s ⚠️ +114ms
nodeModulesSize 66 MB 66 MB -1.27 kB
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -262 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -262 B
link.js 916 kB 916 kB -262 B
routerDirect.js 909 kB 909 kB -262 B
withRouter.js 909 kB 909 kB -262 B
Overall change 4.5 MB 4.5 MB -1.31 kB

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.9s 12.9s ⚠️ +46ms
nodeModulesSize 66 MB 66 MB -1.27 kB
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.288 2.353 ⚠️ +0.07
/ avg req/sec 1092.85 1062.65 -30.2
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.414 1.385 -0.03
/error-in-render avg req/sec 1767.57 1805.6 ⚠️ +38.03
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 924 B
link.html gzip 934 B 934 B
withRouter.html gzip 922 B 922 B
Overall change 2.78 kB 2.78 kB

Diffs

Diff for main-HASH.js
@@ -1464,7 +1464,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for main-HASH.module.js
@@ -1107,7 +1107,6 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-087f0e4219e35a79617c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-7de5e1201b6117a97e03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.7s 13.6s -182ms
nodeModulesSize 66 MB 66 MB -1.27 kB
Client Bundles (main, webpack, commons) Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.58 kB -8 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB -8 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.66 kB -9 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB -9 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -262 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -262 B
link.js 916 kB 916 kB -262 B
routerDirect.js 909 kB 909 kB -262 B
withRouter.js 909 kB 909 kB -262 B
Overall change 4.5 MB 4.5 MB -1.31 kB

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.

I'm pretty sure the intention of pages/index/index.js is to resolve at /, not /index. The updated tests seem to undo that behavior. cc @ijjk

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.

Let's comprehensively test the client-side Link behavior and land this.

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 11.6s 11.6s ⚠️ +29ms
nodeModulesSize 66 MB 66 MB -635 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 1.934 1.912 -0.02
/ avg req/sec 1292.73 1307.76 ⚠️ +15.03
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.127 1.178 ⚠️ +0.05
/error-in-render avg req/sec 2218.22 2122.15 -96.07
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 926 B ⚠️ +2 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +4 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path, ".json");
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute);
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,8 +1740,7 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route, ".js");
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1828,10 +1836,7 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
+                var scriptRoute = getAssetPath(route, ".js");
 
                 if (true && hasNoModule) {
                   scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path, ".json");
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute);
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,8 +1340,7 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route, ".js");
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1413,10 +1421,7 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
+            var scriptRoute = getAssetPath(route, ".js");
 
             if (true && hasNoModule) {
               scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.4s 12.1s -233ms
nodeModulesSize 66 MB 66 MB -635 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -262 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -262 B
link.js 916 kB 916 kB -262 B
routerDirect.js 909 kB 909 kB -262 B
withRouter.js 909 kB 909 kB -262 B
Overall change 4.5 MB 4.5 MB -1.31 kB

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.3s 12.2s -156ms
nodeModulesSize 66 MB 66 MB -635 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.066 2.156 ⚠️ +0.09
/ avg req/sec 1210.03 1159.41 -50.62
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.194 1.158 -0.04
/error-in-render avg req/sec 2093.69 2159.81 ⚠️ +66.12
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 926 B ⚠️ +2 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +4 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path, ".json");
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute);
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,8 +1740,7 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route, ".js");
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1828,10 +1836,7 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
+                var scriptRoute = getAssetPath(route, ".js");
 
                 if (true && hasNoModule) {
                   scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path, ".json");
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute);
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,8 +1340,7 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route, ".js");
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1413,10 +1421,7 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
+            var scriptRoute = getAssetPath(route, ".js");
 
             if (true && hasNoModule) {
               scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.3s 13.2s -62ms
nodeModulesSize 66 MB 66 MB -635 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -262 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -262 B
link.js 916 kB 916 kB -262 B
routerDirect.js 909 kB 909 kB -262 B
withRouter.js 909 kB 909 kB -262 B
Overall change 4.5 MB 4.5 MB -1.31 kB

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.8s 12.5s -242ms
nodeModulesSize 66 MB 66 MB -635 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.281 2.336 ⚠️ +0.05
/ avg req/sec 1095.79 1070.17 -25.62
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.462 1.436 -0.03
/error-in-render avg req/sec 1709.71 1741.04 ⚠️ +31.33
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 926 B ⚠️ +2 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +4 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path, ".json");
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute);
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,8 +1740,7 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route, ".js");
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1828,10 +1836,7 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
+                var scriptRoute = getAssetPath(route, ".js");
 
                 if (true && hasNoModule) {
                   scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path, ".json");
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute);
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,8 +1340,7 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route, ".js");
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1413,10 +1421,7 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
+            var scriptRoute = getAssetPath(route, ".js");
 
             if (true && hasNoModule) {
               scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.8s 13.8s ⚠️ +41ms
nodeModulesSize 66 MB 66 MB -635 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -262 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -262 B
link.js 916 kB 916 kB -262 B
routerDirect.js 909 kB 909 kB -262 B
withRouter.js 909 kB 909 kB -262 B
Overall change 4.5 MB 4.5 MB -1.31 kB

@ijjk
Copy link
Member

ijjk commented Jun 3, 2020

Failing test suites

test/integration/index-index/test/index.test.js

  • nested index.js > dev mode > should ssr page /index/user
  • nested index.js > dev mode > should client render page /index/user
  • nested index.js > dev mode > should follow link to /index/user
  • nested index.js > dev mode > should ssr page /index/project
  • nested index.js > dev mode > should client render page /index/project
  • nested index.js > dev mode > should follow link to /index/project
Expand output

● nested index.js › dev mode › should ssr page /index/user

expect(received).toBe(expected) // Object.is equality

Expected: "index > user"
Received: ""

  81 |     const html = await renderViaHTTP(appPort, '/index/user')
  82 |     const $ = cheerio.load(html)
> 83 |     expect($('#page').text()).toBe('index > user')
     |                               ^
  84 |   })
  85 | 
  86 |   it('should client render page /index/user', async () => {

  at Object.<anonymous> (integration/index-index/test/index.test.js:83:31)

● nested index.js › dev mode › should client render page /index/user

NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"#page"}
  (Session info: headless chrome=81.0.4044.138)

  87 |     const browser = await webdriver(appPort, '/index/user')
  88 |     try {
> 89 |       const text = await browser.elementByCss('#page').text()
     |                    ^
  90 |       expect(text).toBe('index > user')
  91 |     } finally {
  92 |       await browser.close()

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:563:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:489:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:699:17)
  at Object.<anonymous> (integration/index-index/test/index.test.js:89:20)

● nested index.js › dev mode › should client render page /index/user

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  84 |   })
  85 | 
> 86 |   it('should client render page /index/user', async () => {
     |   ^
  87 |     const browser = await webdriver(appPort, '/index/user')
  88 |     try {
  89 |       const text = await browser.elementByCss('#page').text()

  at runTests (integration/index-index/test/index.test.js:86:3)
  at integration/index-index/test/index.test.js:194:5
  at integration/index-index/test/index.test.js:187:3
  at Object.<anonymous> (integration/index-index/test/index.test.js:186:1)

● nested index.js › dev mode › should follow link to /index/user

NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"#page"}
  (Session info: headless chrome=81.0.4044.138)

  347 |   for (let tries = 0; tries < 30; tries++) {
  348 |     try {
> 349 |       content = await contentFn()
      |                 ^
  350 |       if (regex.test(content)) {
  351 |         // found the content
  352 |         return true

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:563:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:489:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:699:17)
  at check (lib/next-test-utils.js:349:17)
  at Object.<anonymous> (integration/index-index/test/index.test.js:101:7)

● nested index.js › dev mode › should follow link to /index/user

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  94 |   })
  95 | 
> 96 |   it('should follow link to /index/user', async () => {
     |   ^
  97 |     const browser = await webdriver(appPort, '/links')
  98 |     try {
  99 |       await browser.elementByCss('#link5').click()

  at runTests (integration/index-index/test/index.test.js:96:3)
  at integration/index-index/test/index.test.js:194:5
  at integration/index-index/test/index.test.js:187:3
  at Object.<anonymous> (integration/index-index/test/index.test.js:186:1)

● nested index.js › dev mode › should ssr page /index/project

expect(received).toBe(expected) // Object.is equality

Expected: "index > project"
Received: ""

  108 |     const html = await renderViaHTTP(appPort, '/index/project')
  109 |     const $ = cheerio.load(html)
> 110 |     expect($('#page').text()).toBe('index > project')
      |                               ^
  111 |   })
  112 | 
  113 |   it('should client render page /index/project', async () => {

  at Object.<anonymous> (integration/index-index/test/index.test.js:110:31)

● nested index.js › dev mode › should client render page /index/project

NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"#page"}
  (Session info: headless chrome=81.0.4044.138)

  114 |     const browser = await webdriver(appPort, '/index/project')
  115 |     try {
> 116 |       const text = await browser.elementByCss('#page').text()
      |                    ^
  117 |       expect(text).toBe('index > project')
  118 |     } finally {
  119 |       await browser.close()

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:563:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:489:26)
      at runMicrotasks (<anonymous>)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:699:17)
  at Object.<anonymous> (integration/index-index/test/index.test.js:116:20)

● nested index.js › dev mode › should client render page /index/project

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  111 |   })
  112 | 
> 113 |   it('should client render page /index/project', async () => {
      |   ^
  114 |     const browser = await webdriver(appPort, '/index/project')
  115 |     try {
  116 |       const text = await browser.elementByCss('#page').text()

  at runTests (integration/index-index/test/index.test.js:113:3)
  at integration/index-index/test/index.test.js:194:5
  at integration/index-index/test/index.test.js:187:3
  at Object.<anonymous> (integration/index-index/test/index.test.js:186:1)

● nested index.js › dev mode › should follow link to /index/project

NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"#page"}
  (Session info: headless chrome=81.0.4044.138)

  347 |   for (let tries = 0; tries < 30; tries++) {
  348 |     try {
> 349 |       content = await contentFn()
      |                 ^
  350 |       if (regex.test(content)) {
  351 |         // found the content
  352 |         return true

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:563:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:489:26)
      at runMicrotasks (<anonymous>)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:699:17)
  at check (lib/next-test-utils.js:349:17)
  at Object.<anonymous> (integration/index-index/test/index.test.js:128:7)

● nested index.js › dev mode › should follow link to /index/project

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  121 |   })
  122 | 
> 123 |   it('should follow link to /index/project', async () => {
      |   ^
  124 |     const browser = await webdriver(appPort, '/links')
  125 |     try {
  126 |       await browser.elementByCss('#link6').click()

  at runTests (integration/index-index/test/index.test.js:123:3)
  at integration/index-index/test/index.test.js:194:5
  at integration/index-index/test/index.test.js:187:3
  at Object.<anonymous> (integration/index-index/test/index.test.js:186:1)

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12s 12.2s ⚠️ +150ms
nodeModulesSize 66 MB 66 MB -984 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 1.98 2.01 ⚠️ +0.03
/ avg req/sec 1262.41 1243.98 -18.43
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.239 1.157 -0.08
/error-in-render avg req/sec 2017.16 2161.33 ⚠️ +144.17
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 926 B ⚠️ +2 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +4 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path, ".json");
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute);
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,8 +1740,7 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route, ".js");
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1828,10 +1836,7 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
+                var scriptRoute = getAssetPath(route, ".js");
 
                 if (true && hasNoModule) {
                   scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path, ".json");
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute);
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,8 +1340,7 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route, ".js");
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1413,10 +1421,7 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
+            var scriptRoute = getAssetPath(route, ".js");
 
             if (true && hasNoModule) {
               scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13s 12.5s -469ms
nodeModulesSize 66 MB 66 MB -984 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Failing test suites

test/integration/route-indexes/test/index.test.js

  • Route indexes handling > dev mode > should handle /api/sub/index correctly
Expand output

● Route indexes handling › dev mode › should handle /api/sub/index correctly

expect(received).toBe(expected) // Object.is equality

Expected: 200
Received: 500

  92 |   it('should handle /api/sub/index correctly', async () => {
  93 |     const res = await fetchViaHTTP(appPort, '/api/sub/index')
> 94 |     expect(res.status).toBe(200)
     |                        ^
  95 |     expect(await res.text()).toContain('hi from sub id')
  96 |   })
  97 | 

  at Object.<anonymous> (integration/route-indexes/test/index.test.js:94:24)

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 11.9s 11.9s -14ms
nodeModulesSize 66 MB 66 MB -980 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 1.998 2.009 ⚠️ +0.01
/ avg req/sec 1251.13 1244.36 -6.77
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.167 1.154 -0.01
/error-in-render avg req/sec 2141.89 2166.8 ⚠️ +24.91
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 926 B ⚠️ +2 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +4 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path, ".json");
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute);
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,8 +1740,7 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route, ".js");
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1828,10 +1836,7 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
+                var scriptRoute = getAssetPath(route, ".js");
 
                 if (true && hasNoModule) {
                   scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route, extension) {
+        return route === "/"
+          ? "/index".concat(extension)
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route).concat(extension)
+          : "".concat(route).concat(extension);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path, ".json");
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute);
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,8 +1340,7 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route, ".js");
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
@@ -1413,10 +1421,7 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
+            var scriptRoute = getAssetPath(route, ".js");
 
             if (true && hasNoModule) {
               scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-dc83edd29d00ce406529.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-440115f103e0d4a1c147.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 15.7s 16s ⚠️ +292ms
nodeModulesSize 66 MB 66 MB -980 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +16 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +19 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +19 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Failing test suites

test/integration/route-indexes/test/index.test.js

  • Route indexes handling > dev mode > should handle /api/sub/index correctly
Expand output

● Route indexes handling › dev mode › should handle /api/sub/index correctly

expect(received).toBe(expected) // Object.is equality

Expected: 200
Received: 500

  92 |   it('should handle /api/sub/index correctly', async () => {
  93 |     const res = await fetchViaHTTP(appPort, '/api/sub/index')
> 94 |     expect(res.status).toBe(200)
     |                        ^
  95 |     expect(await res.text()).toContain('hi from sub id')
  96 |   })
  97 | 

  at Object.<anonymous> (integration/route-indexes/test/index.test.js:94:24)

test/integration/css/test/index.test.js

  • CSS Support > Ordering with Global CSS and Modules (dev) > should have the correct color (css ordering)
Expand output

● CSS Support › Ordering with Global CSS and Modules (dev) › should have the correct color (css ordering)

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `CSS Support Ordering with Global CSS and Modules (dev) should have the correct color (css ordering) 1`

Snapshot: "rgb(0, 0, 255)"
Received: "rgb(255, 0, 0)"

  818 |         `window.getComputedStyle(document.querySelector('#blueText')).color`
  819 |       )
> 820 |       expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 0, 255)"`)
      |                            ^
  821 |     })
  822 | 
  823 |     it('should have the correct color (css ordering) during hot reloads', async () => {

  at Object.<anonymous> (integration/css/test/index.test.js:820:28)

@Janpot
Copy link
Contributor Author

Janpot commented Jun 4, 2020

@Timer tests added

test/integration/production/pages/another.js Outdated Show resolved Hide resolved
test/integration/production/test/index.test.js Outdated Show resolved Hide resolved
test/integration/custom-server/server.js Outdated Show resolved Hide resolved
@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.2s 12.4s ⚠️ +204ms
nodeModulesSize 66 MB 66 MB -644 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.201 2.196 0
/ avg req/sec 1135.85 1138.28 ⚠️ +2.43
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.453 1.4 -0.05
/error-in-render avg req/sec 1720.29 1785.56 ⚠️ +65.27
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 925 B ⚠️ +1 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +3 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path);
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute, ".json");
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,12 +1740,11 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route);
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
-                .concat(encodeURI(scriptRoute));
+                .concat(encodeURI(scriptRoute), ".js");
               this.loadScript(url, route, true);
             }
           },
@@ -1828,19 +1836,13 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
-
-                if (true && hasNoModule) {
-                  scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-                }
-
+                var scriptRoute = getAssetPath(route);
+                var ext = true && hasNoModule ? ".module.js" : ".js";
                 url = ""
                   .concat(this.assetPrefix, "/_next/static/")
                   .concat(encodeURIComponent(this.buildId), "/pages")
-                  .concat(encodeURI(scriptRoute));
+                  .concat(encodeURI(scriptRoute))
+                  .concat(ext);
               }
 
               return Promise.all(
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path);
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute, ".json");
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,12 +1340,11 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route);
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
-            .concat(encodeURI(scriptRoute));
+            .concat(encodeURI(scriptRoute), ".js");
           this.loadScript(url, route, true);
         }
 
@@ -1413,19 +1421,13 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
-
-            if (true && hasNoModule) {
-              scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-            }
-
+            var scriptRoute = getAssetPath(route);
+            var ext = true && hasNoModule ? ".module.js" : ".js";
             url = ""
               .concat(this.assetPrefix, "/_next/static/")
               .concat(encodeURIComponent(this.buildId), "/pages")
-              .concat(encodeURI(scriptRoute));
+              .concat(encodeURI(scriptRoute))
+              .concat(ext);
           }
 
           return Promise.all(
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.4s 13.3s -43ms
nodeModulesSize 66 MB 66 MB -644 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12s 11.5s -461ms
nodeModulesSize 66 MB 66 MB -644 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.046 2.034 -0.01
/ avg req/sec 1221.74 1229.21 ⚠️ +7.47
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.299 1.37 ⚠️ +0.07
/error-in-render avg req/sec 1924.31 1825.24 -99.07
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 925 B ⚠️ +1 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +3 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path);
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute, ".json");
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,12 +1740,11 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route);
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
-                .concat(encodeURI(scriptRoute));
+                .concat(encodeURI(scriptRoute), ".js");
               this.loadScript(url, route, true);
             }
           },
@@ -1828,19 +1836,13 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
-
-                if (true && hasNoModule) {
-                  scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-                }
-
+                var scriptRoute = getAssetPath(route);
+                var ext = true && hasNoModule ? ".module.js" : ".js";
                 url = ""
                   .concat(this.assetPrefix, "/_next/static/")
                   .concat(encodeURIComponent(this.buildId), "/pages")
-                  .concat(encodeURI(scriptRoute));
+                  .concat(encodeURI(scriptRoute))
+                  .concat(ext);
               }
 
               return Promise.all(
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path);
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute, ".json");
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,12 +1340,11 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route);
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
-            .concat(encodeURI(scriptRoute));
+            .concat(encodeURI(scriptRoute), ".js");
           this.loadScript(url, route, true);
         }
 
@@ -1413,19 +1421,13 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
-
-            if (true && hasNoModule) {
-              scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-            }
-
+            var scriptRoute = getAssetPath(route);
+            var ext = true && hasNoModule ? ".module.js" : ".js";
             url = ""
               .concat(this.assetPrefix, "/_next/static/")
               .concat(encodeURIComponent(this.buildId), "/pages")
-              .concat(encodeURI(scriptRoute));
+              .concat(encodeURI(scriptRoute))
+              .concat(ext);
           }
 
           return Promise.all(
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.7s 13s ⚠️ +342ms
nodeModulesSize 66 MB 66 MB -644 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@Timer Timer added this to the 9.4.5 milestone Jun 4, 2020
Timer
Timer previously approved these changes Jun 4, 2020
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.

LGTM. Excited to have this behavior be consistent!

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 11.8s 12s ⚠️ +129ms
nodeModulesSize 66 MB 66 MB -644 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.068 2.129 ⚠️ +0.06
/ avg req/sec 1208.76 1174.02 -34.74
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.348 1.367 ⚠️ +0.02
/error-in-render avg req/sec 1854.64 1828.44 -26.2
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 925 B ⚠️ +1 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +3 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path);
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute, ".json");
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,12 +1740,11 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route);
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
-                .concat(encodeURI(scriptRoute));
+                .concat(encodeURI(scriptRoute), ".js");
               this.loadScript(url, route, true);
             }
           },
@@ -1828,19 +1836,13 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
-
-                if (true && hasNoModule) {
-                  scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-                }
-
+                var scriptRoute = getAssetPath(route);
+                var ext = true && hasNoModule ? ".module.js" : ".js";
                 url = ""
                   .concat(this.assetPrefix, "/_next/static/")
                   .concat(encodeURIComponent(this.buildId), "/pages")
-                  .concat(encodeURI(scriptRoute));
+                  .concat(encodeURI(scriptRoute))
+                  .concat(ext);
               }
 
               return Promise.all(
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path);
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute, ".json");
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,12 +1340,11 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route);
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
-            .concat(encodeURI(scriptRoute));
+            .concat(encodeURI(scriptRoute), ".js");
           this.loadScript(url, route, true);
         }
 
@@ -1413,19 +1421,13 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
-
-            if (true && hasNoModule) {
-              scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-            }
-
+            var scriptRoute = getAssetPath(route);
+            var ext = true && hasNoModule ? ".module.js" : ".js";
             url = ""
               .concat(this.assetPrefix, "/_next/static/")
               .concat(encodeURIComponent(this.buildId), "/pages")
-              .concat(encodeURI(scriptRoute));
+              .concat(encodeURI(scriptRoute))
+              .concat(ext);
           }
 
           return Promise.all(
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.5s 12.6s ⚠️ +48ms
nodeModulesSize 66 MB 66 MB -644 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.9s 13.1s ⚠️ +252ms
nodeModulesSize 66 MB 66 MB -644 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 2.287 2.329 ⚠️ +0.04
/ avg req/sec 1093.34 1073.38 -19.96
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.558 1.498 -0.06
/error-in-render avg req/sec 1604.49 1669.19 ⚠️ +64.7
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 925 B ⚠️ +1 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +3 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path);
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute, ".json");
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,12 +1740,11 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route);
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
-                .concat(encodeURI(scriptRoute));
+                .concat(encodeURI(scriptRoute), ".js");
               this.loadScript(url, route, true);
             }
           },
@@ -1828,19 +1836,13 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
-
-                if (true && hasNoModule) {
-                  scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-                }
-
+                var scriptRoute = getAssetPath(route);
+                var ext = true && hasNoModule ? ".module.js" : ".js";
                 url = ""
                   .concat(this.assetPrefix, "/_next/static/")
                   .concat(encodeURIComponent(this.buildId), "/pages")
-                  .concat(encodeURI(scriptRoute));
+                  .concat(encodeURI(scriptRoute))
+                  .concat(ext);
               }
 
               return Promise.all(
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path);
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute, ".json");
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,12 +1340,11 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route);
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
-            .concat(encodeURI(scriptRoute));
+            .concat(encodeURI(scriptRoute), ".js");
           this.loadScript(url, route, true);
         }
 
@@ -1413,19 +1421,13 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
-
-            if (true && hasNoModule) {
-              scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-            }
-
+            var scriptRoute = getAssetPath(route);
+            var ext = true && hasNoModule ? ".module.js" : ".js";
             url = ""
               .concat(this.assetPrefix, "/_next/static/")
               .concat(encodeURIComponent(this.buildId), "/pages")
-              .concat(encodeURI(scriptRoute));
+              .concat(encodeURI(scriptRoute))
+              .concat(ext);
           }
 
           return Promise.all(
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 13.7s 14s ⚠️ +231ms
nodeModulesSize 66 MB 66 MB -644 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@ijjk
Copy link
Member

ijjk commented Jun 4, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 11.2s 11.8s ⚠️ +568ms
nodeModulesSize 66 MB 66 MB -644 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
/ failed reqs 0 0
/ total time (seconds) 1.987 1.994 ⚠️ +0.01
/ avg req/sec 1258.24 1253.62 -4.62
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.153 1.117 -0.04
/error-in-render avg req/sec 2168.17 2238.92 ⚠️ +70.75
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
index.html gzip 924 B 925 B ⚠️ +1 B
link.html gzip 934 B 935 B ⚠️ +1 B
withRouter.html gzip 922 B 923 B ⚠️ +1 B
Overall change 2.78 kB 2.78 kB ⚠️ +3 B

Diffs

Diff for main-HASH.js
@@ -1427,6 +1427,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports["default"] = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1464,11 +1465,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise(function(res, rej, link) {
           link = document.createElement("link");
@@ -1548,10 +1556,11 @@
                 /** @type string */
                 function getHrefForSlug(path) {
                   path = (0, _router.delBasePath)(path);
+                  var dataRoute = getAssetPath(path);
                   return ""
                     .concat(_this2.assetPrefix, "/_next/data/")
                     .concat(_this2.buildId)
-                    .concat(path === "/" ? "/index" : path, ".json");
+                    .concat(dataRoute, ".json");
                 };
 
               var _ref = (0, _url.parse)(href, true),
@@ -1731,12 +1740,11 @@
             key: "loadRoute",
             value: function loadRoute(route) {
               route = normalizeRoute(route);
-              var scriptRoute =
-                route === "/" ? "/index.js" : "".concat(route, ".js");
+              var scriptRoute = getAssetPath(route);
               var url = ""
                 .concat(this.assetPrefix, "/_next/static/")
                 .concat(encodeURIComponent(this.buildId), "/pages")
-                .concat(encodeURI(scriptRoute));
+                .concat(encodeURI(scriptRoute), ".js");
               this.loadScript(url, route, true);
             }
           },
@@ -1828,19 +1836,13 @@
                 url = route;
               } else {
                 route = normalizeRoute(route);
-                var scriptRoute = "".concat(
-                  route === "/" ? "/index" : route,
-                  ".js"
-                );
-
-                if (true && hasNoModule) {
-                  scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-                }
-
+                var scriptRoute = getAssetPath(route);
+                var ext = true && hasNoModule ? ".module.js" : ".js";
                 url = ""
                   .concat(this.assetPrefix, "/_next/static/")
                   .concat(encodeURIComponent(this.buildId), "/pages")
-                  .concat(encodeURI(scriptRoute));
+                  .concat(encodeURI(scriptRoute))
+                  .concat(ext);
               }
 
               return Promise.all(
Diff for main-HASH.module.js
@@ -1070,6 +1070,7 @@
       var _interopRequireDefault = __webpack_require__("TqRt");
 
       exports.__esModule = true;
+      exports.getAssetPath = getAssetPath;
       exports.default = void 0;
 
       var _url = __webpack_require__("QmWs");
@@ -1107,11 +1108,18 @@
           );
         }
 
-        route = route.replace(/\/index$/, "/");
         if (route === "/") return route;
         return route.replace(/\/$/, "");
       }
 
+      function getAssetPath(route) {
+        return route === "/"
+          ? "/index"
+          : /^\/index(\/|$)/.test(route)
+          ? "/index".concat(route)
+          : "".concat(route);
+      }
+
       function appendLink(href, rel, as) {
         return new Promise((res, rej, link) => {
           link = document.createElement("link");
@@ -1177,10 +1185,11 @@
             /** @type string */
             path => {
               path = (0, _router.delBasePath)(path);
+              var dataRoute = getAssetPath(path);
               return ""
                 .concat(this.assetPrefix, "/_next/data/")
                 .concat(this.buildId)
-                .concat(path === "/" ? "/index" : path, ".json");
+                .concat(dataRoute, ".json");
             };
 
           var { pathname: hrefPathname, query } = (0, _url.parse)(href, true);
@@ -1331,12 +1340,11 @@
 
         loadRoute(route) {
           route = normalizeRoute(route);
-          var scriptRoute =
-            route === "/" ? "/index.js" : "".concat(route, ".js");
+          var scriptRoute = getAssetPath(route);
           var url = ""
             .concat(this.assetPrefix, "/_next/static/")
             .concat(encodeURIComponent(this.buildId), "/pages")
-            .concat(encodeURI(scriptRoute));
+            .concat(encodeURI(scriptRoute), ".js");
           this.loadScript(url, route, true);
         }
 
@@ -1413,19 +1421,13 @@
             url = route;
           } else {
             route = normalizeRoute(route);
-            var scriptRoute = "".concat(
-              route === "/" ? "/index" : route,
-              ".js"
-            );
-
-            if (true && hasNoModule) {
-              scriptRoute = scriptRoute.replace(/\.js$/, ".module.js");
-            }
-
+            var scriptRoute = getAssetPath(route);
+            var ext = true && hasNoModule ? ".module.js" : ".js";
             url = ""
               .concat(this.assetPrefix, "/_next/static/")
               .concat(encodeURIComponent(this.buildId), "/pages")
-              .concat(encodeURI(scriptRoute));
+              .concat(encodeURI(scriptRoute))
+              .concat(ext);
           }
 
           return Promise.all(
Diff for index.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -150,13 +150,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      href="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -145,13 +145,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/runtime/main-750a8131bb83360bfd80.js"
+      src="/_next/static/runtime/main-4fb3b973e7d6059591cd.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-5062a6ab83d04dfd16c2.module.js"
+      src="/_next/static/runtime/main-937ebff178d890c328e4.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
buildDuration 12.6s 12.4s -217ms
nodeModulesSize 66 MB 66 MB -644 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.js gzip 6.59 kB 6.61 kB ⚠️ +20 B
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..6c2a.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB ⚠️ +20 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js clean-index-index Change
main-HASH.module.js gzip 5.67 kB 5.69 kB ⚠️ +22 B
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.93 kB 6.93 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js clean-index-index Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.05 kB 2.05 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.21 kB 8.21 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js clean-index-index Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.32 kB 5.32 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js clean-index-index 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 ✓
vercel/next.js canary Janpot/next.js clean-index-index Change
_error.js 878 kB 878 kB -246 B
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 879 kB 878 kB -246 B
link.js 916 kB 916 kB -246 B
routerDirect.js 909 kB 909 kB -246 B
withRouter.js 909 kB 909 kB -246 B
Overall change 4.5 MB 4.5 MB -1.23 kB

@kodiakhq kodiakhq bot merged commit 1b36f0c into vercel:canary Jun 4, 2020
@Janpot Janpot deleted the clean-index-index branch June 4, 2020 17:33
@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 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