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

Don't use assetprefix on getServerSideProps and getStaticProps #15634

Merged
merged 6 commits into from
Jul 29, 2020

Conversation

Janpot
Copy link
Contributor

@Janpot Janpot commented Jul 29, 2020

Strictly use basePath and not assetPrefix on getStaticProps and getServerSideProps

Fixes #15563

@ijjk
Copy link
Member

ijjk commented Jul 29, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
buildDuration 13.2s 13.2s -11ms
nodeModulesSize 65.5 MB 65.5 MB ⚠️ +599 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
/ failed reqs 0 0
/ total time (seconds) 2.411 2.44 ⚠️ +0.03
/ avg req/sec 1036.89 1024.63 ⚠️ -12.26
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.496 1.5 0
/error-in-render avg req/sec 1670.82 1666.28 ⚠️ -4.54
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..b7a9.js gzip 10.2 kB 10.2 kB ⚠️ +6 B
framework.HASH.js gzip 39.1 kB 39.1 kB
main-c5a676d..82de.js gzip 6.75 kB 6.75 kB ⚠️ +6 B
webpack-488d..c0e7.js gzip 751 B 751 B
Overall change 56.8 kB 56.8 kB ⚠️ +12 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..dule.js gzip 6.09 kB 6.09 kB ⚠️ +4 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-079bffd..dule.js gzip 5.83 kB 5.83 kB ⚠️ +4 B
webpack-4f62..dule.js gzip 751 B 751 B
Overall change 51.8 kB 51.8 kB ⚠️ +8 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
polyfills-05..1236.js gzip 30.8 kB 30.8 kB
Overall change 30.8 kB 30.8 kB
Client Pages
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-8f5f611..1f7b.js gzip 1.28 kB 1.28 kB
_error-a98d9..5cb7.js gzip 3.45 kB 3.45 kB
hooks-f7f3d0..7465.js gzip 887 B 887 B
index-08fb3f..c0e9.js gzip 227 B 227 B
link-6f8445b..99e1.js gzip 1.3 kB 1.3 kB
routerDirect..8aa1.js gzip 284 B 284 B
withRouter-f..e777.js gzip 284 B 284 B
Overall change 7.72 kB 7.72 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-669dbe5..dule.js gzip 626 B 626 B
_error-d5979..dule.js gzip 2.3 kB 2.3 kB
hooks-805c40..dule.js gzip 387 B 387 B
index-6ba5a4..dule.js gzip 226 B 226 B
link-91516ae..dule.js gzip 1.25 kB 1.25 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-d..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_buildManifest.js gzip 274 B 274 B
_buildManife..dule.js gzip 282 B 282 B
Overall change 556 B 556 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
index.html gzip 947 B 947 B
link.html gzip 952 B 953 B ⚠️ +1 B
withRouter.html gzip 937 B 939 B ⚠️ +2 B
Overall change 2.84 kB 2.84 kB ⚠️ +3 B

Diffs

Diff for 677f882d2ed8..f9.module.js
@@ -1139,24 +1139,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
               var isValidElementType;
             }
 
-            var dataHref;
-
-            if (__N_SSG || __N_SSP) {
-              dataHref = this.pageLoader.getDataHref(
-                (0, _utils.formatWithValidation)({
-                  pathname,
-                  query
-                }),
-                as,
-                __N_SSG
-              );
-            }
-
             var props = await this._getData(() =>
               __N_SSG
-                ? this._getStaticData(dataHref)
+                ? this._getStaticData(pathname, query, as)
                 : __N_SSP
-                ? this._getServerData(dataHref)
+                ? this._getServerData(pathname, query, as)
                 : this.getInitialProps(
                     Component, // we provide AppTree later so this needs to be `any`
                     {
@@ -1315,7 +1302,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           });
         }
 
-        _getStaticData(dataHref) {
+        _getStaticData(pathname, query, as) {
+          var dataHref = this.pageLoader.getDataHref(
+            (0, _utils.formatWithValidation)({
+              pathname,
+              query
+            }),
+            as,
+            true
+          );
           var { href: cacheKey } = new URL(dataHref, window.location.href);
 
           if (true && this.sdc[cacheKey]) {
@@ -1328,8 +1323,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
           });
         }
 
-        _getServerData(dataHref) {
-          return fetchNextData(dataHref, this.isSsr);
+        _getServerData(pathname, query, as) {
+          var dataHref = this.pageLoader.getDataHref(
+            (0, _utils.formatWithValidation)({
+              pathname,
+              query
+            }),
+            as,
+            false
+          );
+          return fetchNextData(addBasePath(dataHref), this.isSsr);
         }
 
         getInitialProps(Component, ctx) {
Diff for 677f882d2ed8..dbb170329.js
@@ -1484,7 +1484,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       __N_SSP,
                       _require,
                       isValidElementType,
-                      dataHref,
                       props,
                       _args3 = arguments;
 
@@ -1577,23 +1576,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               );
 
                             case 18:
-                              if (__N_SSG || __N_SSP) {
-                                dataHref = this.pageLoader.getDataHref(
-                                  (0, _utils.formatWithValidation)({
-                                    pathname: pathname,
-                                    query: query
-                                  }),
-                                  as,
-                                  __N_SSG
-                                );
-                              }
-
-                              _context3.next = 21;
+                              _context3.next = 20;
                               return this._getData(function() {
                                 return __N_SSG
-                                  ? _this2._getStaticData(dataHref)
+                                  ? _this2._getStaticData(pathname, query, as)
                                   : __N_SSP
-                                  ? _this2._getServerData(dataHref)
+                                  ? _this2._getServerData(pathname, query, as)
                                   : _this2.getInitialProps(
                                       Component, // we provide AppTree later so this needs to be `any`
                                       {
@@ -1604,14 +1592,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                     );
                               });
 
-                            case 21:
+                            case 20:
                               props = _context3.sent;
                               routeInfo.props = props;
                               this.components[route] = routeInfo;
                               return _context3.abrupt("return", routeInfo);
 
-                            case 27:
-                              _context3.prev = 27;
+                            case 26:
+                              _context3.prev = 26;
                               _context3.t1 = _context3["catch"](1);
                               return _context3.abrupt(
                                 "return",
@@ -1623,7 +1611,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                                 )
                               );
 
-                            case 30:
+                            case 29:
                             case "end":
                               return _context3.stop();
                           }
@@ -1631,7 +1619,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       },
                       _callee3,
                       this,
-                      [[1, 27]]
+                      [[1, 26]]
                     );
                   })
                 );
@@ -1910,9 +1898,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             },
             {
               key: "_getStaticData",
-              value: function _getStaticData(dataHref) {
+              value: function _getStaticData(pathname, query, as) {
                 var _this4 = this;
 
+                var dataHref = this.pageLoader.getDataHref(
+                  (0, _utils.formatWithValidation)({
+                    pathname: pathname,
+                    query: query
+                  }),
+                  as,
+                  true
+                );
+
                 var _URL = new URL(dataHref, window.location.href),
                   cacheKey = _URL.href;
 
@@ -1928,8 +1925,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
             },
             {
               key: "_getServerData",
-              value: function _getServerData(dataHref) {
-                return fetchNextData(dataHref, this.isSsr);
+              value: function _getServerData(pathname, query, as) {
+                var dataHref = this.pageLoader.getDataHref(
+                  (0, _utils.formatWithValidation)({
+                    pathname: pathname,
+                    query: query
+                  }),
+                  as,
+                  false
+                );
+                return fetchNextData(addBasePath(dataHref), this.isSsr);
               }
             },
             {
Diff for main-0339d3d..dbbe74217.js
@@ -1652,7 +1652,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                     ".json"
                   );
                   return ""
-                    .concat(_this2.assetPrefix, "/_next/data/")
+                    .concat(ssg ? _this2.assetPrefix : "", "/_next/data/")
                     .concat(_this2.buildId)
                     .concat(dataRoute)
                     .concat(ssg ? "" : search || "");
Diff for main-e403002..90.module.js
@@ -1270,7 +1270,7 @@
                 ".json"
               );
               return ""
-                .concat(this.assetPrefix, "/_next/data/")
+                .concat(ssg ? this.assetPrefix : "", "/_next/data/")
                 .concat(this.buildId)
                 .concat(dataRoute)
                 .concat(ssg ? "" : search || "");
Diff for index.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e403002201f89e776690.module.js"
+      href="/_next/static/chunks/main-4493ec8a2d6109ba9c28.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.277a28e61ddacb493af9.module.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.44b5c50d7d1d504bb077.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0339d3d0a31dbbe74217.js"
+      src="/_next/static/chunks/main-28610181fbff010ab363.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e403002201f89e776690.module.js"
+      src="/_next/static/chunks/main-4493ec8a2d6109ba9c28.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.289defeb577dbb170329.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.22cbfeff2d452595c1d3.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.277a28e61ddacb493af9.module.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.44b5c50d7d1d504bb077.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e403002201f89e776690.module.js"
+      href="/_next/static/chunks/main-4493ec8a2d6109ba9c28.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.277a28e61ddacb493af9.module.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.44b5c50d7d1d504bb077.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -86,13 +86,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0339d3d0a31dbbe74217.js"
+      src="/_next/static/chunks/main-28610181fbff010ab363.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e403002201f89e776690.module.js"
+      src="/_next/static/chunks/main-4493ec8a2d6109ba9c28.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -122,13 +122,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.289defeb577dbb170329.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.22cbfeff2d452595c1d3.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.277a28e61ddacb493af9.module.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.44b5c50d7d1d504bb077.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-e403002201f89e776690.module.js"
+      href="/_next/static/chunks/main-4493ec8a2d6109ba9c28.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.277a28e61ddacb493af9.module.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.44b5c50d7d1d504bb077.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-0339d3d0a31dbbe74217.js"
+      src="/_next/static/chunks/main-28610181fbff010ab363.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-e403002201f89e776690.module.js"
+      src="/_next/static/chunks/main-4493ec8a2d6109ba9c28.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.289defeb577dbb170329.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.22cbfeff2d452595c1d3.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.277a28e61ddacb493af9.module.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.44b5c50d7d1d504bb077.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
buildDuration 14.7s 14.7s -2ms
nodeModulesSize 65.5 MB 65.5 MB ⚠️ +599 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..b7a9.js gzip 10.2 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
main-c5a676d..82de.js gzip 6.75 kB N/A N/A
webpack-488d..c0e7.js gzip 751 B 751 B
677f882d2ed8..cc54.js gzip N/A 10.2 kB N/A
main-cd4f6f3..259c.js gzip N/A 6.75 kB N/A
Overall change 56.8 kB 56.8 kB ⚠️ +12 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..dule.js gzip 6.09 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-079bffd..dule.js gzip 5.83 kB N/A N/A
webpack-4f62..dule.js gzip 751 B 751 B
677f882d2ed8..dule.js gzip N/A 6.09 kB N/A
main-d632c1a..dule.js gzip N/A 5.83 kB N/A
Overall change 51.8 kB 51.8 kB ⚠️ +8 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
polyfills-05..1236.js gzip 30.8 kB 30.8 kB
Overall change 30.8 kB 30.8 kB
Client Pages
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-8f5f611..1f7b.js gzip 1.28 kB 1.28 kB
_error-a98d9..5cb7.js gzip 3.45 kB 3.45 kB
hooks-f7f3d0..7465.js gzip 887 B 887 B
index-08fb3f..c0e9.js gzip 227 B 227 B
link-6f8445b..99e1.js gzip 1.3 kB 1.3 kB
routerDirect..8aa1.js gzip 284 B 284 B
withRouter-f..e777.js gzip 284 B 284 B
Overall change 7.72 kB 7.72 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-669dbe5..dule.js gzip 626 B 626 B
_error-d5979..dule.js gzip 2.3 kB 2.3 kB
hooks-805c40..dule.js gzip 387 B 387 B
index-6ba5a4..dule.js gzip 226 B 226 B
link-91516ae..dule.js gzip 1.25 kB 1.25 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-d..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_buildManifest.js gzip 274 B 274 B
_buildManife..dule.js gzip 282 B 282 B
Overall change 556 B 556 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_error.js 1.02 MB 1.02 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.02 MB 1.02 MB
link.js 1.06 MB 1.06 MB ⚠️ +114 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +114 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +114 B
Overall change 5.2 MB 5.2 MB ⚠️ +342 B
Commit: 58c046f

@ijjk
Copy link
Member

ijjk commented Jul 29, 2020

Failing test suites

Commit: 58c046f

test/integration/size-limit/test/index.test.js

  • Production response size > should not increase the overall response size of default build
Expand output

● Production response size › should not increase the overall response size of default build

expect(received).toBeLessThanOrEqual(expected)

Expected: <= 1024
Received:    1045

  82 |     // These numbers are without gzip compression!
  83 |     const delta = responseSizesBytes - 274 * 1024
> 84 |     expect(delta).toBeLessThanOrEqual(1024) // don't increase size more than 1kb
     |                   ^
  85 |     expect(delta).toBeGreaterThanOrEqual(-1024) // don't decrease size more than 1kb without updating target
  86 |   })
  87 | 

  at Object.<anonymous> (integration/size-limit/test/index.test.js:84:19)

@Timer
Copy link
Member

Timer commented Jul 29, 2020

getStaticProps nor getServerSideProps should be fetched from assetPath.

getStaticProps should probably only fetch from assetPath if the application was exported via next export, what do you think?

@Janpot Janpot changed the title Don't use assetprefix on getServerSideProps Don't use assetprefix on getServerSideProps and getStaticProps Jul 29, 2020
@ijjk
Copy link
Member

ijjk commented Jul 29, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
buildDuration 13.4s 13.4s ⚠️ +55ms
nodeModulesSize 65.5 MB 65.5 MB ⚠️ +100 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
/ failed reqs 0 0
/ total time (seconds) 2.379 2.449 ⚠️ +0.07
/ avg req/sec 1051.01 1020.77 ⚠️ -30.24
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.269 1.387 ⚠️ +0.12
/error-in-render avg req/sec 1969.42 1802.64 ⚠️ -166.78
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..b7a9.js gzip 10.2 kB 10.2 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-53ec37c..bf7f.js gzip 6.75 kB 6.76 kB ⚠️ +10 B
webpack-488d..c0e7.js gzip 751 B 751 B
Overall change 56.8 kB 56.8 kB ⚠️ +10 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..dule.js gzip 6.09 kB 6.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-5b25224..dule.js gzip 5.83 kB 5.83 kB ⚠️ +10 B
webpack-4f62..dule.js gzip 751 B 751 B
Overall change 51.8 kB 51.8 kB ⚠️ +10 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
polyfills-05..1236.js gzip 30.8 kB 30.8 kB
Overall change 30.8 kB 30.8 kB
Client Pages
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-8f5f611..1f7b.js gzip 1.28 kB 1.28 kB
_error-a98d9..5cb7.js gzip 3.45 kB 3.45 kB
hooks-f7f3d0..7465.js gzip 887 B 887 B
index-08fb3f..c0e9.js gzip 227 B 227 B
link-6f8445b..99e1.js gzip 1.3 kB 1.3 kB
routerDirect..8aa1.js gzip 284 B 284 B
withRouter-f..e777.js gzip 284 B 284 B
Overall change 7.72 kB 7.72 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-669dbe5..dule.js gzip 626 B 626 B
_error-d5979..dule.js gzip 2.3 kB 2.3 kB
hooks-805c40..dule.js gzip 387 B 387 B
index-6ba5a4..dule.js gzip 226 B 226 B
link-91516ae..dule.js gzip 1.25 kB 1.25 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-d..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_buildManifest.js gzip 274 B 274 B
_buildManife..dule.js gzip 282 B 282 B
Overall change 556 B 556 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
index.html gzip 947 B 947 B
link.html gzip 953 B 953 B
withRouter.html gzip 940 B 939 B -1 B
Overall change 2.84 kB 2.84 kB -1 B

Diffs

Diff for main-32ee03b..96b4fbf43.js
@@ -1502,6 +1502,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         __webpack_require__("Lab5")
       );
 
+      var _router = __webpack_require__("elyg");
+
       function hasRel(rel, link) {
         try {
           link = document.createElement("link");
@@ -1651,11 +1653,12 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                     path,
                     ".json"
                   );
-                  return ""
-                    .concat(_this2.assetPrefix, "/_next/data/")
-                    .concat(_this2.buildId)
-                    .concat(dataRoute)
-                    .concat(ssg ? "" : search || "");
+                  return (0, _router.addBasePath)(
+                    "/_next/data/"
+                      .concat(_this2.buildId)
+                      .concat(dataRoute)
+                      .concat(ssg ? "" : search)
+                  );
                 };
 
               var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
Diff for main-545c3c9..82.module.js
@@ -1141,6 +1141,8 @@
         __webpack_require__("Lab5")
       );
 
+      var _router = __webpack_require__("elyg");
+
       function hasRel(rel, link) {
         try {
           link = document.createElement("link");
@@ -1269,11 +1271,12 @@
                 path,
                 ".json"
               );
-              return ""
-                .concat(this.assetPrefix, "/_next/data/")
-                .concat(this.buildId)
-                .concat(dataRoute)
-                .concat(ssg ? "" : search || "");
+              return (0, _router.addBasePath)(
+                "/_next/data/"
+                  .concat(this.buildId)
+                  .concat(dataRoute)
+                  .concat(ssg ? "" : search)
+              );
             };
 
           var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
Diff for index.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      href="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-32ee03b6ed496b4fbf43.js"
+      src="/_next/static/chunks/main-87b0c07a2de1473b7dc6.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      src="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      href="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -86,13 +86,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-32ee03b6ed496b4fbf43.js"
+      src="/_next/static/chunks/main-87b0c07a2de1473b7dc6.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      src="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      href="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-32ee03b6ed496b4fbf43.js"
+      src="/_next/static/chunks/main-87b0c07a2de1473b7dc6.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      src="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
buildDuration 14.8s 14.7s -128ms
nodeModulesSize 65.5 MB 65.5 MB ⚠️ +100 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..b7a9.js gzip 10.2 kB 10.2 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-53ec37c..bf7f.js gzip 6.75 kB N/A N/A
webpack-488d..c0e7.js gzip 751 B 751 B
main-92edf74..65de.js gzip N/A 6.76 kB N/A
Overall change 56.8 kB 56.8 kB ⚠️ +10 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..dule.js gzip 6.09 kB 6.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-5b25224..dule.js gzip 5.83 kB N/A N/A
webpack-4f62..dule.js gzip 751 B 751 B
main-42d5470..dule.js gzip N/A 5.83 kB N/A
Overall change 51.8 kB 51.8 kB ⚠️ +10 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
polyfills-05..1236.js gzip 30.8 kB 30.8 kB
Overall change 30.8 kB 30.8 kB
Client Pages
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-8f5f611..1f7b.js gzip 1.28 kB 1.28 kB
_error-a98d9..5cb7.js gzip 3.45 kB 3.45 kB
hooks-f7f3d0..7465.js gzip 887 B 887 B
index-08fb3f..c0e9.js gzip 227 B 227 B
link-6f8445b..99e1.js gzip 1.3 kB 1.3 kB
routerDirect..8aa1.js gzip 284 B 284 B
withRouter-f..e777.js gzip 284 B 284 B
Overall change 7.72 kB 7.72 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-669dbe5..dule.js gzip 626 B 626 B
_error-d5979..dule.js gzip 2.3 kB 2.3 kB
hooks-805c40..dule.js gzip 387 B 387 B
index-6ba5a4..dule.js gzip 226 B 226 B
link-91516ae..dule.js gzip 1.25 kB 1.25 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-d..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_buildManifest.js gzip 274 B 274 B
_buildManife..dule.js gzip 282 B 282 B
Overall change 556 B 556 B
Serverless bundles
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_error.js 1.02 MB 1.02 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.02 MB 1.02 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.2 MB 5.2 MB
Commit: 2582c39

@Janpot Janpot marked this pull request as ready for review July 29, 2020 16:32
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 since search is always '' from new URL()!

@ijjk
Copy link
Member

ijjk commented Jul 29, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
buildDuration 11.8s 11.8s ⚠️ +41ms
nodeModulesSize 65.5 MB 65.5 MB ⚠️ +100 B
Page Load Tests Overall increase ✓
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
/ failed reqs 0 0
/ total time (seconds) 2.079 2.101 ⚠️ +0.02
/ avg req/sec 1202.43 1190.05 ⚠️ -12.38
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.137 1.109 -0.03
/error-in-render avg req/sec 2199.61 2254.94 +55.33
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..b7a9.js gzip 10.2 kB 10.2 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-53ec37c..bf7f.js gzip 6.75 kB 6.76 kB ⚠️ +10 B
webpack-488d..c0e7.js gzip 751 B 751 B
Overall change 56.8 kB 56.8 kB ⚠️ +10 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..dule.js gzip 6.09 kB 6.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-5b25224..dule.js gzip 5.83 kB 5.83 kB ⚠️ +10 B
webpack-4f62..dule.js gzip 751 B 751 B
Overall change 51.8 kB 51.8 kB ⚠️ +10 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
polyfills-05..1236.js gzip 30.8 kB 30.8 kB
Overall change 30.8 kB 30.8 kB
Client Pages
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-8f5f611..1f7b.js gzip 1.28 kB 1.28 kB
_error-a98d9..5cb7.js gzip 3.45 kB 3.45 kB
hooks-f7f3d0..7465.js gzip 887 B 887 B
index-08fb3f..c0e9.js gzip 227 B 227 B
link-6f8445b..99e1.js gzip 1.3 kB 1.3 kB
routerDirect..8aa1.js gzip 284 B 284 B
withRouter-f..e777.js gzip 284 B 284 B
Overall change 7.72 kB 7.72 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-669dbe5..dule.js gzip 626 B 626 B
_error-d5979..dule.js gzip 2.3 kB 2.3 kB
hooks-805c40..dule.js gzip 387 B 387 B
index-6ba5a4..dule.js gzip 226 B 226 B
link-91516ae..dule.js gzip 1.25 kB 1.25 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-d..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_buildManifest.js gzip 274 B 274 B
_buildManife..dule.js gzip 282 B 282 B
Overall change 556 B 556 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
index.html gzip 947 B 947 B
link.html gzip 953 B 953 B
withRouter.html gzip 940 B 939 B -1 B
Overall change 2.84 kB 2.84 kB -1 B

Diffs

Diff for main-32ee03b..96b4fbf43.js
@@ -1502,6 +1502,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         __webpack_require__("Lab5")
       );
 
+      var _router = __webpack_require__("elyg");
+
       function hasRel(rel, link) {
         try {
           link = document.createElement("link");
@@ -1651,11 +1653,12 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                     path,
                     ".json"
                   );
-                  return ""
-                    .concat(_this2.assetPrefix, "/_next/data/")
-                    .concat(_this2.buildId)
-                    .concat(dataRoute)
-                    .concat(ssg ? "" : search || "");
+                  return (0, _router.addBasePath)(
+                    "/_next/data/"
+                      .concat(_this2.buildId)
+                      .concat(dataRoute)
+                      .concat(ssg ? "" : search)
+                  );
                 };
 
               var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
Diff for main-545c3c9..82.module.js
@@ -1141,6 +1141,8 @@
         __webpack_require__("Lab5")
       );
 
+      var _router = __webpack_require__("elyg");
+
       function hasRel(rel, link) {
         try {
           link = document.createElement("link");
@@ -1269,11 +1271,12 @@
                 path,
                 ".json"
               );
-              return ""
-                .concat(this.assetPrefix, "/_next/data/")
-                .concat(this.buildId)
-                .concat(dataRoute)
-                .concat(ssg ? "" : search || "");
+              return (0, _router.addBasePath)(
+                "/_next/data/"
+                  .concat(this.buildId)
+                  .concat(dataRoute)
+                  .concat(ssg ? "" : search)
+              );
             };
 
           var isDynamic = (0, _isDynamic.isDynamicRoute)(route),
Diff for index.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      href="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-32ee03b6ed496b4fbf43.js"
+      src="/_next/static/chunks/main-87b0c07a2de1473b7dc6.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      src="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      href="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -86,13 +86,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-32ee03b6ed496b4fbf43.js"
+      src="/_next/static/chunks/main-87b0c07a2de1473b7dc6.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      src="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      href="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-cdbbd579644400b29b58.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-32ee03b6ed496b4fbf43.js"
+      src="/_next/static/chunks/main-87b0c07a2de1473b7dc6.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-545c3c95919cb251ab82.module.js"
+      src="/_next/static/chunks/main-cb2c0e61b3142d471151.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
buildDuration 13.1s 13.2s ⚠️ +53ms
nodeModulesSize 65.5 MB 65.5 MB ⚠️ +100 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..b7a9.js gzip 10.2 kB 10.2 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-53ec37c..bf7f.js gzip 6.75 kB N/A N/A
webpack-488d..c0e7.js gzip 751 B 751 B
main-92edf74..65de.js gzip N/A 6.76 kB N/A
Overall change 56.8 kB 56.8 kB ⚠️ +10 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
677f882d2ed8..dule.js gzip 6.09 kB 6.09 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-5b25224..dule.js gzip 5.83 kB N/A N/A
webpack-4f62..dule.js gzip 751 B 751 B
main-42d5470..dule.js gzip N/A 5.83 kB N/A
Overall change 51.8 kB 51.8 kB ⚠️ +10 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
polyfills-05..1236.js gzip 30.8 kB 30.8 kB
Overall change 30.8 kB 30.8 kB
Client Pages
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-8f5f611..1f7b.js gzip 1.28 kB 1.28 kB
_error-a98d9..5cb7.js gzip 3.45 kB 3.45 kB
hooks-f7f3d0..7465.js gzip 887 B 887 B
index-08fb3f..c0e9.js gzip 227 B 227 B
link-6f8445b..99e1.js gzip 1.3 kB 1.3 kB
routerDirect..8aa1.js gzip 284 B 284 B
withRouter-f..e777.js gzip 284 B 284 B
Overall change 7.72 kB 7.72 kB
Client Pages Modern
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_app-669dbe5..dule.js gzip 626 B 626 B
_error-d5979..dule.js gzip 2.3 kB 2.3 kB
hooks-805c40..dule.js gzip 387 B 387 B
index-6ba5a4..dule.js gzip 226 B 226 B
link-91516ae..dule.js gzip 1.25 kB 1.25 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-d..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.36 kB
Client Build Manifests
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_buildManifest.js gzip 274 B 274 B
_buildManife..dule.js gzip 282 B 282 B
Overall change 556 B 556 B
Serverless bundles
vercel/next.js canary Janpot/next.js gssp-assetprefix Change
_error.js 1.02 MB 1.02 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.02 MB 1.02 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.2 MB 5.2 MB
Commit: 0d05437

@kodiakhq kodiakhq bot merged commit 80998a0 into vercel:canary Jul 29, 2020
@Janpot Janpot deleted the gssp-assetprefix branch July 29, 2020 17:09
LauraBeatris pushed a commit to LauraBeatris/next.js that referenced this pull request Sep 1, 2020
…l#15634)

Strictly use `basePath` and not `assetPrefix` on `getStaticProps` and `getServerSideProps`

Fixes vercel#15563
@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.

fail fetching getServerSideProps with basePath
3 participants