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 bug with getServerSideProps when swcLoader is enabled #29760

Merged
merged 11 commits into from
Oct 9, 2021

Conversation

timneutkens
Copy link
Member

@timneutkens timneutkens commented Oct 9, 2021

Ported from #29185

These are all related to swcLoader:

  • Fixes commonjs code being output as ESM
  • Fixes bug with getServerSideProps not getting querystrings and added tests for it
  • Disable SWC on Babel test suites
  • Disable SWC on no-anon-default-export test suite
  • Disable SWC on page-config test suite (pending porting of the Babel plugin)
  • Ensure sourcesContent is part of the sourcemap

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes

@timneutkens
Copy link
Member Author

Triggered the SWC recompile action

@ijjk

This comment has been minimized.

@ijjk
Copy link
Member

ijjk commented Oct 9, 2021

Stats from current PR

Default Build (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
buildDuration 12.3s 12.3s ⚠️ +27ms
buildDurationCached 2.9s 2.9s -14ms
nodeModulesSize 194 MB 194 MB ⚠️ +415 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
/ failed reqs 0 0
/ total time (seconds) 2.746 2.769 ⚠️ +0.02
/ avg req/sec 910.34 902.9 ⚠️ -7.44
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.286 1.315 ⚠️ +0.03
/error-in-render avg req/sec 1943.64 1900.87 ⚠️ -42.77
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
779.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 26.9 kB 26.9 kB
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 70.8 kB 70.8 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
polyfills-a4..dd70.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
_app-HASH.js gzip 977 B 977 B
_error-HASH.js gzip 194 B 194 B
amp-HASH.js gzip 311 B 311 B
css-HASH.js gzip 328 B 328 B
dynamic-HASH.js gzip 2.67 kB 2.67 kB
head-HASH.js gzip 351 B 351 B
hooks-HASH.js gzip 918 B 918 B
image-HASH.js gzip 4.12 kB 4.12 kB
index-HASH.js gzip 260 B 260 B
link-HASH.js gzip 1.66 kB 1.66 kB
routerDirect..HASH.js gzip 320 B 320 B
script-HASH.js gzip 386 B 386 B
withRouter-HASH.js gzip 319 B 319 B
bb14e60e810b..30f.css gzip 125 B 125 B
Overall change 12.9 kB 12.9 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
_buildManifest.js gzip 494 B 494 B
Overall change 494 B 494 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
index.html gzip 539 B 539 B
link.html gzip 551 B 551 B
withRouter.html gzip 533 B 533 B
Overall change 1.62 kB 1.62 kB

Default Build with SWC (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
buildDuration 6.2s 6.3s ⚠️ +100ms
buildDurationCached 3s 2.9s -105ms
nodeModulesSize 194 MB 194 MB ⚠️ +415 B
Page Load Tests Overall increase ✓
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
/ failed reqs 0 0
/ total time (seconds) 2.781 2.745 -0.04
/ avg req/sec 898.8 910.59 +11.79
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.307 1.295 -0.01
/error-in-render avg req/sec 1912.66 1930.94 +18.28
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
675-HASH.js gzip 13.8 kB 13.8 kB
770.HASH.js gzip 178 B 178 B
framework-HASH.js gzip 50.7 kB 50.7 kB
main-HASH.js gzip 35 kB 35 kB
webpack-HASH.js gzip 1.64 kB 1.64 kB
Overall change 101 kB 101 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
polyfills-a4..dd70.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
_app-HASH.js gzip 1.33 kB 1.33 kB
_error-HASH.js gzip 180 B 180 B
amp-HASH.js gzip 315 B 315 B
css-HASH.js gzip 331 B 331 B
dynamic-HASH.js gzip 2.79 kB 2.79 kB
head-HASH.js gzip 356 B 355 B -1 B
hooks-HASH.js gzip 637 B 637 B
image-HASH.js gzip 557 B 555 B -2 B
index-HASH.js gzip 262 B 261 B -1 B
link-HASH.js gzip 2.22 kB 2.22 kB
routerDirect..HASH.js gzip 326 B 326 B
script-HASH.js gzip 393 B 393 B
withRouter-HASH.js gzip 322 B 322 B
bb14e60e810b..30f.css gzip 125 B 125 B
Overall change 10.1 kB 10.1 kB -4 B
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
_buildManifest.js gzip 511 B 511 B
Overall change 511 B 511 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary timneutkens/next.js fix/gssp-swc-bug Change
index.html gzip 539 B 537 B -2 B
link.html gzip 552 B 552 B
withRouter.html gzip 533 B 533 B
Overall change 1.62 kB 1.62 kB -2 B

Diffs

Diff for _buildManifest.js
@@ -1,6 +1,6 @@
 self.__BUILD_MANIFEST = {
   __rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },
-  "/": ["static\u002Fchunks\u002Fpages\u002Findex-578dd16f542138d115d9.js"],
+  "/": ["static\u002Fchunks\u002Fpages\u002Findex-ab3eacf0db76ede5c34e.js"],
   "/_error": [
     "static\u002Fchunks\u002Fpages\u002F_error-9e1a6d936e12ddc840ba.js"
   ],
@@ -10,25 +10,25 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fcss-b933e198cac52ec08478.js"
   ],
   "/dynamic": [
-    "static\u002Fchunks\u002Fpages\u002Fdynamic-2c0ea1f3fa06461635ef.js"
+    "static\u002Fchunks\u002Fpages\u002Fdynamic-6d23c90f2595f3596b95.js"
   ],
-  "/head": ["static\u002Fchunks\u002Fpages\u002Fhead-94efda3a2dea2f3c43a9.js"],
+  "/head": ["static\u002Fchunks\u002Fpages\u002Fhead-7bb5bee479e60e9cbbf6.js"],
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-57657d9807f56726f7b7.js"
   ],
   "/image": [
     "static\u002Fchunks\u002F675-e36478c6435f19ec761d.js",
-    "static\u002Fchunks\u002Fpages\u002Fimage-54733aeb9002fa108f3f.js"
+    "static\u002Fchunks\u002Fpages\u002Fimage-7adb256b36a03439bd79.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-7f8f722ace4fedf0a7aa.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-88e6441e88b717c1f4fe.js"],
   "/routerDirect": [
-    "static\u002Fchunks\u002Fpages\u002FrouterDirect-0d86a6c6dd6bc4048b0b.js"
+    "static\u002Fchunks\u002Fpages\u002FrouterDirect-afb5e539aab48677ee82.js"
   ],
   "/script": [
-    "static\u002Fchunks\u002Fpages\u002Fscript-c1a5847a6de5a67f5d87.js"
+    "static\u002Fchunks\u002Fpages\u002Fscript-3bd2b6d599dff985e742.js"
   ],
   "/withRouter": [
-    "static\u002Fchunks\u002Fpages\u002FwithRouter-4ecb289970809ca52b13.js"
+    "static\u002Fchunks\u002Fpages\u002FwithRouter-42d971b6e1d5b9681097.js"
   ],
   sortedPages: [
     "\u002F",
Diff for dynamic-HASH.js
@@ -576,8 +576,8 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
@@ -623,7 +623,7 @@
           }
         );
       };
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__["default"] = Page;
 
       /***/
Diff for head-HASH.js
@@ -24,8 +24,8 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
@@ -60,7 +60,7 @@
           }
         );
       };
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__["default"] = Page;
 
       /***/
Diff for image-HASH.js
@@ -27,8 +27,8 @@
 
       // EXPORTS
       __webpack_require__.d(__webpack_exports__, {
-        __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        __N_SSP: function() {
+          return /* binding */ __N_SSP;
         },
         default: function() {
           return /* binding */ pages_image;
@@ -60,7 +60,7 @@
           ]
         });
       }
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ var pages_image = ImagePage;
 
       /***/
Diff for index-HASH.js
@@ -24,15 +24,15 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
       var Page = function() {
         return "Hello world 👋";
       };
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__["default"] = Page;
 
       /***/
Diff for link-HASH.js
@@ -461,8 +461,8 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
@@ -492,7 +492,7 @@
           ]
         });
       }
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__["default"] = aLink;
 
       /***/
Diff for routerDirect-HASH.js
@@ -24,8 +24,8 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
@@ -44,7 +44,7 @@
           children: "I import the router directly"
         });
       }
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__[
         "default"
       ] = routerDirect;
Diff for script-HASH.js
@@ -24,8 +24,8 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
@@ -59,7 +59,7 @@
           }
         );
       };
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__["default"] = Page;
 
       /***/
Diff for withRouter-HASH.js
@@ -24,8 +24,8 @@
       "use strict";
       __webpack_require__.r(__webpack_exports__);
       /* harmony export */ __webpack_require__.d(__webpack_exports__, {
-        /* harmony export */ __N_SSG: function() {
-          return /* binding */ __N_SSG;
+        /* harmony export */ __N_SSP: function() {
+          return /* binding */ __N_SSP;
         }
         /* harmony export */
       });
@@ -42,7 +42,7 @@
           children: "I use withRouter"
         });
       }
-      var __N_SSG = true;
+      var __N_SSP = true;
       /* harmony default export */ __webpack_exports__["default"] = (0,
       next_router__WEBPACK_IMPORTED_MODULE_1__.withRouter)(useWithRouter);
Diff for index.html
@@ -27,7 +27,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/index-578dd16f542138d115d9.js"
+      src="/_next/static/chunks/pages/index-ab3eacf0db76ede5c34e.js"
       defer=""
     ></script>
     <script src="/_next/static/BUILD_ID/_buildManifest.js" defer=""></script>
Diff for link.html
@@ -27,7 +27,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-7f8f722ace4fedf0a7aa.js"
+      src="/_next/static/chunks/pages/link-88e6441e88b717c1f4fe.js"
       defer=""
     ></script>
     <script src="/_next/static/BUILD_ID/_buildManifest.js" defer=""></script>
Diff for withRouter.html
@@ -27,7 +27,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/withRouter-4ecb289970809ca52b13.js"
+      src="/_next/static/chunks/pages/withRouter-42d971b6e1d5b9681097.js"
       defer=""
     ></script>
     <script src="/_next/static/BUILD_ID/_buildManifest.js" defer=""></script>
Commit: 02c0ec2

@kodiakhq kodiakhq bot merged commit 628bb39 into vercel:canary Oct 9, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants