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

[Experimental] Add basePath support #9872

Merged
merged 5 commits into from
Dec 29, 2019

Conversation

timneutkens
Copy link
Member

@timneutkens timneutkens commented Dec 29, 2019

  • Experimental, don't use it yet.
  • Adds support for basePath that prefixes urls with the provided path.
  • <Link> should use the normal path, excluding the basePath
    • Eg when basePath is /dashboard and you have pages/blog.js and pages/about.js the href would be /about and not /dashboard/about

Ref #4998

@ijjk
Copy link
Member

ijjk commented Dec 29, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
buildDuration 13.4s 13.7s ⚠️ +228ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +4.01 kB
Client Bundles (main, webpack, commons)
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..b209642b9.js N/A 38.3 kB N/A
de003c3a9d30..42b9.js gzip N/A 13.9 kB N/A
Overall change 206 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..47.module.js N/A 33.2 kB N/A
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary timneutkens/next.js add/basepath Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary timneutkens/next.js add/basepath Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary timneutkens/next.js add/basepath Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.04 kB 1.04 kB
link.html 4.11 kB 4.11 kB
link.html gzip 1.04 kB 1.04 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB ⚠️ +1 B
Overall change 12.3 kB 12.3 kB

Diffs

Diff for index.html
@@ -18,7 +18,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -58,9 +58,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/BUILD_ID/_buildManifest.js" async=""
         crossorigin="anonymous" nomodule=""></script>
Diff for link.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-aa390d7127bc86496460.module.js"
         as="script" crossorigin="anonymous" />
@@ -57,9 +57,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-9e2d6aced589db67bbc3.js"
         async="" crossorigin="anonymous" nomodule=""></script>
Diff for withRouter.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-aa390d7127bc86496460.module.js"
         as="script" crossorigin="anonymous" />
@@ -55,9 +55,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-9e2d6aced589db67bbc3.js"
         async="" crossorigin="anonymous" nomodule=""></script>

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
buildDuration 13.8s 13.7s -94ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +4.01 kB
Client Bundles (main, webpack, commons)
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..b209642b9.js N/A 38.3 kB N/A
de003c3a9d30..42b9.js gzip N/A 13.9 kB N/A
Overall change 206 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..47.module.js N/A 33.2 kB N/A
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary timneutkens/next.js add/basepath Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary timneutkens/next.js add/basepath Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
_error.js 299 kB 299 kB ⚠️ +168 B
_error.js gzip 78.8 kB 78.8 kB -20 B
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB ⚠️ +1 B
index.js 299 kB 299 kB ⚠️ +223 B
index.js gzip 79.1 kB 79.1 kB -17 B
link.js 306 kB 306 kB ⚠️ +223 B
link.js gzip 81.1 kB 81.2 kB ⚠️ +88 B
routerDirect.js 299 kB 299 kB ⚠️ +223 B
routerDirect.js gzip 79.1 kB 79.2 kB ⚠️ +33 B
withRouter.js 299 kB 299 kB ⚠️ +223 B
withRouter.js gzip 79.3 kB 79.3 kB -8 B
Overall change 1.51 MB 1.51 MB ⚠️ +1.06 kB

Commit: 40a652d

@ijjk
Copy link
Member

ijjk commented Dec 29, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
buildDuration 13.2s 13s -226ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +4.46 kB
Client Bundles (main, webpack, commons)
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..b209642b9.js N/A 38.3 kB N/A
de003c3a9d30..42b9.js gzip N/A 13.9 kB N/A
Overall change 206 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..47.module.js N/A 33.2 kB N/A
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary timneutkens/next.js add/basepath Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary timneutkens/next.js add/basepath Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary timneutkens/next.js add/basepath Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.04 kB 1.04 kB
link.html 4.11 kB 4.11 kB
link.html gzip 1.04 kB 1.04 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB ⚠️ +1 B
Overall change 12.3 kB 12.3 kB

Diffs

Diff for index.html
@@ -18,7 +18,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -58,9 +58,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/BUILD_ID/_buildManifest.js" async=""
         crossorigin="anonymous" nomodule=""></script>
Diff for link.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-aa390d7127bc86496460.module.js"
         as="script" crossorigin="anonymous" />
@@ -57,9 +57,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-9e2d6aced589db67bbc3.js"
         async="" crossorigin="anonymous" nomodule=""></script>
Diff for withRouter.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-aa390d7127bc86496460.module.js"
         as="script" crossorigin="anonymous" />
@@ -55,9 +55,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-9e2d6aced589db67bbc3.js"
         async="" crossorigin="anonymous" nomodule=""></script>

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
buildDuration 13.2s 13.3s ⚠️ +130ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +4.46 kB
Client Bundles (main, webpack, commons)
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..b209642b9.js N/A 38.3 kB N/A
de003c3a9d30..42b9.js gzip N/A 13.9 kB N/A
Overall change 206 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..47.module.js N/A 33.2 kB N/A
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary timneutkens/next.js add/basepath Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary timneutkens/next.js add/basepath Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
_error.js 299 kB 299 kB ⚠️ +175 B
_error.js gzip 78.8 kB 78.8 kB -18 B
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB ⚠️ +1 B
index.js 299 kB 299 kB ⚠️ +230 B
index.js gzip 79.1 kB 79.1 kB -14 B
link.js 306 kB 306 kB ⚠️ +230 B
link.js gzip 81.1 kB 81.2 kB ⚠️ +89 B
routerDirect.js 299 kB 299 kB ⚠️ +230 B
routerDirect.js gzip 79.1 kB 79.2 kB ⚠️ +34 B
withRouter.js 299 kB 299 kB ⚠️ +230 B
withRouter.js gzip 79.3 kB 79.3 kB -7 B
Overall change 1.51 MB 1.51 MB ⚠️ +1.09 kB

Commit: adc5b3f

@ijjk
Copy link
Member

ijjk commented Dec 29, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
buildDuration 13.3s 13.4s ⚠️ +110ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +4.47 kB
Client Bundles (main, webpack, commons)
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..b209642b9.js N/A 38.3 kB N/A
de003c3a9d30..42b9.js gzip N/A 13.9 kB N/A
Overall change 206 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..47.module.js N/A 33.2 kB N/A
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary timneutkens/next.js add/basepath Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary timneutkens/next.js add/basepath Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary timneutkens/next.js add/basepath Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.04 kB 1.04 kB
link.html 4.11 kB 4.11 kB
link.html gzip 1.04 kB 1.04 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB ⚠️ +1 B
Overall change 12.3 kB 12.3 kB

Diffs

Diff for index.html
@@ -18,7 +18,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -58,9 +58,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/BUILD_ID/_buildManifest.js" async=""
         crossorigin="anonymous" nomodule=""></script>
Diff for link.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-aa390d7127bc86496460.module.js"
         as="script" crossorigin="anonymous" />
@@ -57,9 +57,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-9e2d6aced589db67bbc3.js"
         async="" crossorigin="anonymous" nomodule=""></script>
Diff for withRouter.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-aa390d7127bc86496460.module.js"
         as="script" crossorigin="anonymous" />
@@ -55,9 +55,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.68807fa95b88fa05cff2.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.965cb7e0a8d6ce22cb48.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-9e2d6aced589db67bbc3.js"
         async="" crossorigin="anonymous" nomodule=""></script>

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
buildDuration 13.8s 14s ⚠️ +213ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +4.47 kB
Client Bundles (main, webpack, commons)
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..b209642b9.js N/A 38.3 kB N/A
de003c3a9d30..42b9.js gzip N/A 13.9 kB N/A
Overall change 206 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..47.module.js N/A 33.2 kB N/A
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary timneutkens/next.js add/basepath Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary timneutkens/next.js add/basepath Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary timneutkens/next.js add/basepath Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary timneutkens/next.js add/basepath Change
_error.js 299 kB 299 kB ⚠️ +175 B
_error.js gzip 78.8 kB 78.8 kB -18 B
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB ⚠️ +1 B
index.js 299 kB 299 kB ⚠️ +230 B
index.js gzip 79.1 kB 79.1 kB -14 B
link.js 306 kB 306 kB ⚠️ +230 B
link.js gzip 81.1 kB 81.2 kB ⚠️ +89 B
routerDirect.js 299 kB 299 kB ⚠️ +230 B
routerDirect.js gzip 79.1 kB 79.2 kB ⚠️ +34 B
withRouter.js 299 kB 299 kB ⚠️ +230 B
withRouter.js gzip 79.3 kB 79.3 kB -7 B
Overall change 1.51 MB 1.51 MB ⚠️ +1.09 kB

Commit: 2506429

@timneutkens timneutkens merged commit 86808bb into vercel:canary Dec 29, 2019
@timneutkens timneutkens deleted the add/basepath branch December 29, 2019 19:03
@timneutkens timneutkens changed the title Add basePath support [Experimental] Add basePath support Dec 29, 2019
@Janpot
Copy link
Contributor

Janpot commented Jan 7, 2020

@timneutkens Fully aware this is just experimental but I took it for a quick test. Awesome that you are looking into this. 2 points of preliminary feedback (feel free to ignore):

  1. Link doesn't seem to add the basePath prefix yet
  2. It would be useful to also be able to access the basePath on the router, i.e.
    const { basePath } = useRouter();
    and/or somewhere in the NextPageContext. (use-case: tried to add a rel="canonical" url in the <head> that is relative to the basePath)

@kelvinlouis
Copy link

kelvinlouis commented Jan 17, 2020

While testing the basePath experimental flag I noticed the following:

The basePath will not be shown when hovering over a link. Thus, the actual or complete link is not visible to the user, before actually clicking the link. If the user does a right click on the link and selects open in a new tab the URL that is being loaded by the browser does not contain the base path.

Example:

basePath: '/pre',

<Link href="/some-page">Click me</Link>

The user will see http://some-url.com/some-page instead of http://some-url.com/pre/some-page when hovering over the URL. Additionally, if we add the prefix manually to the href attribute, the page will always be rendered on the server instead of on the client.

@Janpot
Copy link
Contributor

Janpot commented Jan 17, 2020

@kelvinlouis should be fixed soon #9988

@kelvinlouis
Copy link

Is there anything I can do to help this get resolved?

@Timer
Copy link
Member

Timer commented Jan 20, 2020

No news/progress on this yet. Please note, like OP, this is completely experimental and should not be used—we might even remove it.

@kelvinlouis
Copy link

kelvinlouis commented Jan 21, 2020

Thanks for the update.

We are aware of the possible reprecussions of using this experimental feature. However, this is the only way we can use Next.js, considering the hosting constraints we have, and still have the ability to use shallow rendering. Page reloads when navigating to a page is not feasible for us.

We want to build on Next.js in the future. Having basePath support is key for us and by looking at #4998, not just for us. This is why I was asking if there was anything I could do to help.

If you decide to remove it, please let us know why, and how you intend to support the cases highlighted in #4998.

@serge20
Copy link

serge20 commented Apr 10, 2020

@timneutkens I've been waiting for this feature for over a year, would you know how this would work with Router.push?
Would we need to pass for example Router.push('/about'), and it would send you to /dashboard/about? or do we need to pass the full path like Router.push('/dashboard/about')?

@serge20
Copy link

serge20 commented May 4, 2020

@timneutkens it seems like experimental basePath does not work for api routes? Any chance it can be added there?

@ijjk
Copy link
Member

ijjk commented May 4, 2020

Hi @serge20, can you provide a repo with a minimal reproduction where the basePath is not working with API routes?

@serge20
Copy link

serge20 commented May 4, 2020

@ijjk my bad, it's working! Would you happen to know how to use basePath with Router.push? Do we need to explicitly pass the basePath param? or does Router.push automatically prefix it fo us?

@ijjk
Copy link
Member

ijjk commented May 4, 2020

@serge20 on the latest version of Next.js the experimental basePath is automatically added when using next/link or next/router

@fabiocarneiro
Copy link

@ijjk latest version which one? I tested on 9.4.0 and 9.4.1 canaries. Although it's possible to click the link and see the page, it does not include the basePath in the address bar.

@ijjk
Copy link
Member

ijjk commented May 16, 2020

@fabiocarneiro can you provide a reproduction where the basePath isn't being added on the latest 9.4.1 canaries? We have tests covering this so this is most likely specific to your project and would need more information to investigate

@LucasMallmann
Copy link

@ijjk I also have the same problem as @fabiocarneiro . Although you can navigate to the page, it does not include the basePath in the address bar, and if you reload the page, there's a 404 error.

@ijjk
Copy link
Member

ijjk commented May 19, 2020

@LucasMallmann as mentioned in the above comment we have tests that should cover this so a repo with a reproduction where this behavior is occurring would be needed to help investigate

@serge20
Copy link

serge20 commented May 20, 2020

@LucasMallmann @fabiocarneiro how are you guys navigating to those pages through the Link component or Router.push? I have it working fine on my project. If you guys can share a sample of what you're doing I might be able to help.

@Sletheren
Copy link

@ijjk will there be support to make the basePath an array instead? especially if you have multiple basePath that you can access the application with! and defining the basePath in build time is not possible, since its kinda dynamic

@fabiocarneiro
Copy link

I checked again in the last version and it is working as expected... For some reason, it wasn't working when using the 9.3.x, I was not able to figure out why.

@spb-ratnam
Copy link

spb-ratnam commented Jun 9, 2020

@serge20 Can you please share an example how it's working for you?
I'm using next 9.4.4 and have added basePath to next.config.js, but when I'm routing to some url it does not add the basePath set in config.
More information, I'm getting a run time error which says as url incompatible with the href url.

@fabiocarneiro
Copy link

fabiocarneiro commented Jun 9, 2020

I think I understood the problem. It only works with next dev. I don't know if only this feature or any experimental feature is ignored when running in the production mode.

IMHO, this is a very weird behavior because even when running in production mode, the console warns You have enabled experimental feature(s), which makes anyone think those features are actually active. I would say either the features should be active even in the production mode or the message of active experimental shouldn't be there. I would personally prefer the first. The less differences between the development mode and production mode, the easier it is to understand the behavior.

I would also suggest that there is some debug information in the console when the application starts, showing all the active flags and their values...

@serge20
Copy link

serge20 commented Jun 9, 2020

@fabiocarneiro how did you come to the conclusion that it only works with next dev? I have it running on next start after next build. I did a quick example here: https://github.com/serge20/nextjs-basepath that is deployed on https://base-path-example.now.sh/custom-path/ (custom-path) being the basePath passed in next.config.js. I also have a similar concept running on a docker container on AWS ECS and it works as expected.

@spb-ratnam
Copy link

@serge20 Thanks for the example, it works for me in production mode (npm run build) but the routed pages keeps reloading (IDK why). 🤔
Also, the assetPrefix is not working along with this.

@fabiocarneiro
Copy link

how did you come to the conclusion that it only works with next dev?

@serge20 Well, I tried with yarn start. didn't work, I tried with yarn dev, it did work. Those map to next start and next dev

@spb-ratnam Afaik, assetPrefix doesn't work on img assets, but only on nextjs compiled assets (css,js). The experimental basePath also modifies assetPrefix automatically as long as it is empty. What I did to go around was the following:

import ExampleName from '../../public/image.svg'

class Component {
    render (
        <img src={ExampleName}>
    )
}

@serge20
Copy link

serge20 commented Jun 13, 2020

@serge20 Thanks for the example, it works for me in production mode (npm run build) but the routed pages keeps reloading (IDK why). 🤔
Also, the assetPrefix is not working along with this.

@spb-ratnam At this point I'd have to see how you have your project set up. I've been using basePath on 3-4 different projects with no issues whatsoever, however I don't use assetPrefix as of now.

@serge20
Copy link

serge20 commented Jun 13, 2020

how did you come to the conclusion that it only works with next dev?

@serge20 Well, I tried with yarn start. didn't work, I tried with yarn dev, it did work. Those map to next start and next dev

@spb-ratnam Afaik, assetPrefix doesn't work on img assets, but only on nextjs compiled assets (css,js). The experimental basePath also modifies assetPrefix automatically as long as it is empty. What I did to go around was the following:

import ExampleName from '../../public/image.svg'

class Component {
    render (
        <img src={ExampleName}>
    )
}

@fabiocarneiro if you're open to sharing your project, I'd be more than happy to take a look at why it's not working for you on prod.

@svenheden
Copy link
Contributor

Is it possible to use basePath only for non-pages? E.g. currently we serve our static assets from /static/foo/*, and our pages from /:market/foo/*. This works fine and dandy except for when we start to use getServerSideProps(). Next then tries to fetch the server side data from /_next, when we want this to be fetched from /static/foo/_next instead. basePath can help with this, but then all pages needs to live under /static/foo/* as well, which doesn't make sense for us.

@Unsfer
Copy link

Unsfer commented Jun 19, 2020

I have an interesting behavior with <Link> in dev mode, similar to #5606 where the page reloads a few seconds after first render.

<Link href="/somepage">
  <a>Go to some page</a>
</Link>

Without experimental.basePath page reloads disappear

@ijjk
Copy link
Member

ijjk commented Jun 19, 2020

@Unsfer Are you seeing this behavior on the latest canary? There have been some fixes to the feature

@Unsfer
Copy link

Unsfer commented Jun 19, 2020

Updating to 9.4.5-canary.13 helped, thanks

@Unsfer
Copy link

Unsfer commented Jun 19, 2020

But now I get hard reload when going by <Link> to root page (href="/") which has getServerSideProps. Other pages with getServerSideProps seems fine. Removing getServerSideProps on root page fixes hard reload

@ijjk
Copy link
Member

ijjk commented Jun 19, 2020

@Unsfer I see, thanks for providing details on this. I opened a PR to address this here #14376

kodiakhq bot pushed a commit that referenced this pull request Jun 19, 2020
This corrects the `/_next/data` path generated when using `basePath` with `getStaticProps` in a `pages/index.js` file which was previously stripping the `basePath` without checking if `/index` needed to be appended after stripping. This also adds additional checks to the `basePath` test suite to prevent regressing   

x-ref: #9872 (comment)
rokinsky pushed a commit to rokinsky/next.js that referenced this pull request Jul 11, 2020
This corrects the `/_next/data` path generated when using `basePath` with `getStaticProps` in a `pages/index.js` file which was previously stripping the `basePath` without checking if `/index` needed to be appended after stripping. This also adds additional checks to the `basePath` test suite to prevent regressing   

x-ref: vercel#9872 (comment)
@dkempner
Copy link

@ijjk thanks so much for supporting this! I just confirmed that issues with HMR + basePath are resolved when working on canary 31.

This really helps!

@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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.