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

feat: Implement webpack require hook #21802

Merged
merged 6 commits into from
Feb 4, 2021

Conversation

guybedford
Copy link
Contributor

This implements the compatibility require hook as per #21789.

The hook is applied at the point of webpack initialization. In addition the separate packages are exposed for the various webpack subrequires.

The test then ensures instance equality for the basic require hook from the next.js config file.

I suspect this might have bad interactions with Yarn Pnp support, but maybe we will be lucky.

@ijjk

This comment has been minimized.

@ijjk
Copy link
Member

ijjk commented Feb 3, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 11.5s 11.1s -334ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +6.93 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
/ failed reqs 0 0
/ total time (seconds) 2.206 2.23 ⚠️ +0.02
/ avg req/sec 1133.35 1121.03 ⚠️ -12.32
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.534 1.578 ⚠️ +0.04
/error-in-render avg req/sec 1630.01 1584.05 ⚠️ -45.96
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Rendered Page Sizes
vercel/next.js canary guybedford/next.js webpack-require-hook Change
index.html gzip 615 B 615 B
link.html gzip 621 B 621 B
withRouter.html gzip 609 B 609 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 13.1s 12.9s -195ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +6.93 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Serverless bundles
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.19 MB 5.19 MB

Webpack 5 Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 13.5s 13.5s ⚠️ +10ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +6.93 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
/ failed reqs 0 0
/ total time (seconds) 2.243 2.286 ⚠️ +0.04
/ avg req/sec 1114.57 1093.78 ⚠️ -20.79
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.6 1.654 ⚠️ +0.05
/error-in-render avg req/sec 1562.88 1511.52 ⚠️ -51.36
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
597-6c246419..806f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.58 kB 6.58 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 59.9 kB 59.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-6e0a903..b885.js gzip 1.26 kB 1.26 kB
_error-7a100..a392.js gzip 3.38 kB 3.38 kB
hooks-f7e199..11b9.js gzip 904 B 904 B
index-3dc22c..ffbb.js gzip 232 B 232 B
link-c010d28..b60a.js gzip 1.63 kB 1.63 kB
routerDirect..323a.js gzip 308 B 308 B
withRouter-a..2ef8.js gzip 304 B 304 B
Overall change 8.02 kB 8.02 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 299 B 299 B
Overall change 299 B 299 B
Rendered Page Sizes
vercel/next.js canary guybedford/next.js webpack-require-hook Change
index.html gzip 586 B 586 B
link.html gzip 593 B 593 B
withRouter.html gzip 579 B 579 B
Overall change 1.76 kB 1.76 kB

Diffs

Diff for index.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "MN-btaEmL3Jj9JkAP8Puu",
+        "buildId": "0lkOK8DfaZsoguZ-FnlQq",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/MN-btaEmL3Jj9JkAP8Puu/_buildManifest.js"
+      src="/_next/static/0lkOK8DfaZsoguZ-FnlQq/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/MN-btaEmL3Jj9JkAP8Puu/_ssgManifest.js"
+      src="/_next/static/0lkOK8DfaZsoguZ-FnlQq/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "MN-btaEmL3Jj9JkAP8Puu",
+        "buildId": "0lkOK8DfaZsoguZ-FnlQq",
         "isFallback": false,
         "gip": true
       }
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/MN-btaEmL3Jj9JkAP8Puu/_buildManifest.js"
+      src="/_next/static/0lkOK8DfaZsoguZ-FnlQq/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/MN-btaEmL3Jj9JkAP8Puu/_ssgManifest.js"
+      src="/_next/static/0lkOK8DfaZsoguZ-FnlQq/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "MN-btaEmL3Jj9JkAP8Puu",
+        "buildId": "0lkOK8DfaZsoguZ-FnlQq",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/MN-btaEmL3Jj9JkAP8Puu/_buildManifest.js"
+      src="/_next/static/0lkOK8DfaZsoguZ-FnlQq/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/MN-btaEmL3Jj9JkAP8Puu/_ssgManifest.js"
+      src="/_next/static/0lkOK8DfaZsoguZ-FnlQq/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: 5cda09b

@ijjk
Copy link
Member

ijjk commented Feb 3, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 11.3s 11.2s -88ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +6.93 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
/ failed reqs 0 0
/ total time (seconds) 2.283 2.324 ⚠️ +0.04
/ avg req/sec 1095.06 1075.54 ⚠️ -19.52
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.564 1.578 ⚠️ +0.01
/error-in-render avg req/sec 1598.56 1584.53 ⚠️ -14.03
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Rendered Page Sizes
vercel/next.js canary guybedford/next.js webpack-require-hook Change
index.html gzip 615 B 615 B
link.html gzip 621 B 621 B
withRouter.html gzip 609 B 609 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 13s 13.4s ⚠️ +391ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +6.93 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Serverless bundles
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.19 MB 5.19 MB

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 13.8s 13.6s -109ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +6.93 kB
Page Load Tests Overall increase ✓
vercel/next.js canary guybedford/next.js webpack-require-hook Change
/ failed reqs 0 0
/ total time (seconds) 2.362 2.231 -0.13
/ avg req/sec 1058.61 1120.64 +62.03
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.698 1.602 -0.1
/error-in-render avg req/sec 1472.45 1560.91 +88.46
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
597-6c246419..806f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.58 kB 6.58 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 59.9 kB 59.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-6e0a903..b885.js gzip 1.26 kB 1.26 kB
_error-7a100..a392.js gzip 3.38 kB 3.38 kB
hooks-f7e199..11b9.js gzip 904 B 904 B
index-3dc22c..ffbb.js gzip 232 B 232 B
link-c010d28..b60a.js gzip 1.63 kB 1.63 kB
routerDirect..323a.js gzip 308 B 308 B
withRouter-a..2ef8.js gzip 304 B 304 B
Overall change 8.02 kB 8.02 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 299 B 299 B
Overall change 299 B 299 B
Rendered Page Sizes
vercel/next.js canary guybedford/next.js webpack-require-hook Change
index.html gzip 586 B 586 B
link.html gzip 593 B 593 B
withRouter.html gzip 579 B 579 B
Overall change 1.76 kB 1.76 kB

Diffs

Diff for index.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "5SOD-1XX0mMeFlspS89LI",
+        "buildId": "OfFBW0bT5J2f4lId5pGV6",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/5SOD-1XX0mMeFlspS89LI/_buildManifest.js"
+      src="/_next/static/OfFBW0bT5J2f4lId5pGV6/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/5SOD-1XX0mMeFlspS89LI/_ssgManifest.js"
+      src="/_next/static/OfFBW0bT5J2f4lId5pGV6/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "5SOD-1XX0mMeFlspS89LI",
+        "buildId": "OfFBW0bT5J2f4lId5pGV6",
         "isFallback": false,
         "gip": true
       }
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/5SOD-1XX0mMeFlspS89LI/_buildManifest.js"
+      src="/_next/static/OfFBW0bT5J2f4lId5pGV6/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/5SOD-1XX0mMeFlspS89LI/_ssgManifest.js"
+      src="/_next/static/OfFBW0bT5J2f4lId5pGV6/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "5SOD-1XX0mMeFlspS89LI",
+        "buildId": "OfFBW0bT5J2f4lId5pGV6",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/5SOD-1XX0mMeFlspS89LI/_buildManifest.js"
+      src="/_next/static/OfFBW0bT5J2f4lId5pGV6/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/5SOD-1XX0mMeFlspS89LI/_ssgManifest.js"
+      src="/_next/static/OfFBW0bT5J2f4lId5pGV6/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: 2fded53

@ijjk
Copy link
Member

ijjk commented Feb 4, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 9.8s 9.7s -104ms
nodeModulesSize 75.3 MB 75.3 MB ⚠️ +6.93 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
/ failed reqs 0 0
/ total time (seconds) 1.998 2.076 ⚠️ +0.08
/ avg req/sec 1251.33 1204.29 ⚠️ -47.04
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.357 1.459 ⚠️ +0.1
/error-in-render avg req/sec 1842.39 1712.99 ⚠️ -129.4
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Rendered Page Sizes
vercel/next.js canary guybedford/next.js webpack-require-hook Change
index.html gzip 615 B 615 B
link.html gzip 620 B 620 B
withRouter.html gzip 609 B 609 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 11.4s 11.3s -118ms
nodeModulesSize 75.3 MB 75.3 MB ⚠️ +6.93 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Serverless bundles
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.19 MB 5.19 MB

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary guybedford/next.js webpack-require-hook Change
buildDuration 12.3s 12s -253ms
nodeModulesSize 75.3 MB 75.3 MB ⚠️ +6.93 kB
Page Load Tests Overall increase ✓
vercel/next.js canary guybedford/next.js webpack-require-hook Change
/ failed reqs 0 0
/ total time (seconds) 2.078 2.08 0
/ avg req/sec 1203.07 1202.06 ⚠️ -1.01
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.423 1.376 -0.05
/error-in-render avg req/sec 1756.33 1816.84 +60.51
Client Bundles (main, webpack, commons)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
597-6c246419..806f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.58 kB 6.58 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 59.9 kB 59.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary guybedford/next.js webpack-require-hook Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_app-6e0a903..b885.js gzip 1.26 kB 1.26 kB
_error-7a100..a392.js gzip 3.38 kB 3.38 kB
hooks-f7e199..11b9.js gzip 904 B 904 B
index-3dc22c..ffbb.js gzip 232 B 232 B
link-c010d28..b60a.js gzip 1.63 kB 1.63 kB
routerDirect..323a.js gzip 308 B 308 B
withRouter-a..2ef8.js gzip 304 B 304 B
Overall change 8.02 kB 8.02 kB
Client Build Manifests
vercel/next.js canary guybedford/next.js webpack-require-hook Change
_buildManifest.js gzip 299 B 299 B
Overall change 299 B 299 B
Rendered Page Sizes
vercel/next.js canary guybedford/next.js webpack-require-hook Change
index.html gzip 585 B 585 B
link.html gzip 592 B 592 B
withRouter.html gzip 579 B 579 B
Overall change 1.76 kB 1.76 kB

Diffs

Diff for index.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "GebgEVS9O_310SwX-2Hho",
+        "buildId": "RQTcBTLFhEIHlWush2-2j",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/GebgEVS9O_310SwX-2Hho/_buildManifest.js"
+      src="/_next/static/RQTcBTLFhEIHlWush2-2j/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/GebgEVS9O_310SwX-2Hho/_ssgManifest.js"
+      src="/_next/static/RQTcBTLFhEIHlWush2-2j/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "GebgEVS9O_310SwX-2Hho",
+        "buildId": "RQTcBTLFhEIHlWush2-2j",
         "isFallback": false,
         "gip": true
       }
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/GebgEVS9O_310SwX-2Hho/_buildManifest.js"
+      src="/_next/static/RQTcBTLFhEIHlWush2-2j/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/GebgEVS9O_310SwX-2Hho/_ssgManifest.js"
+      src="/_next/static/RQTcBTLFhEIHlWush2-2j/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "GebgEVS9O_310SwX-2Hho",
+        "buildId": "RQTcBTLFhEIHlWush2-2j",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/GebgEVS9O_310SwX-2Hho/_buildManifest.js"
+      src="/_next/static/RQTcBTLFhEIHlWush2-2j/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/GebgEVS9O_310SwX-2Hho/_ssgManifest.js"
+      src="/_next/static/RQTcBTLFhEIHlWush2-2j/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: 68d983f

@kodiakhq kodiakhq bot merged commit 234e1c9 into vercel:canary Feb 4, 2021
// the individual compiled modules are as defined for the compilation in bundles/webpack/packages/*

const hookPropertyMap = new Map([
['webpack', 'next/dist/compiled/webpack/webpack-lib'],
Copy link
Contributor

Choose a reason for hiding this comment

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

These next paths need to be absolute otherwise you run into hoisting issues

Copy link
Contributor

Choose a reason for hiding this comment

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

Should just be a matter of calling require.resolve on the properties, or even just a path.join(__dirname, ...)

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixing it in #21877

@merceyz merceyz mentioned this pull request Feb 4, 2021
@merceyz
Copy link
Contributor

merceyz commented Feb 4, 2021

The hook doesn't seem to be registered early enough. Fixing it in #21877

const webpack1 = require.resolve('webpack');

module.exports = {
	webpack: (config) => {
		const webpack2 = require.resolve('webpack');

		if (webpack1 !== webpack2) {
			throw new Error('KO');
		}

		return config;
	},
};

I suspect this might have bad interactions with Yarn Pnp support, but maybe we will be lucky.

Just tested and it works as long as the thing making the require is the project, once I make the paths absolute works perfectly fine.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants