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 serverless chunking #8569

Merged
merged 3 commits into from
Aug 30, 2019
Merged

Fix serverless chunking #8569

merged 3 commits into from
Aug 30, 2019

Conversation

Timer
Copy link
Member

@Timer Timer commented Aug 30, 2019

tl;dr: the ServerlessPlugin was enabled for client-side builds.

This only affected Next.js deploys that did not have a next.config.js, deploys with next.config.js were toggled to the Serverless Trace mode which was not affected by this.

This PR also adds a test for both Serverless and Serverless Trace modes to ensure this doesn't happen again.

A PR to fix the auto-toggling to serverless trace is here: vercel/vercel#2924.


The meat of this change:

https://github.com/zeit/next.js/pull/8569/files#diff-4ec59a55144129a45f46da71c0777df9R593


Fixes #8550

@Timer Timer added this to the 9.0.6 milestone Aug 30, 2019
@ijjk
Copy link
Member

ijjk commented Aug 30, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
buildDuration 22.7s 22.3s -408ms
nodeModulesSize 41.8 MB 41.8 MB -78 B
Client Bundles (main, webpack, commons) Overall decrease ✓
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
main-HASH.js 18.2 kB 18.2 kB -1 B
main-HASH.js gzip 6.64 kB 6.64 kB -1 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
Overall change -1 B
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
main-HASH.module.js 16.5 kB 16.5 kB -1 B
main-HASH.module.js gzip 6.38 kB 6.37 kB -1 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
Overall change -1 B
Client Pages Overall increase ⚠️
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_app.js 1.83 kB 1.83 kB
_app.js gzip 884 B 884 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB ⚠️ +1 B
hooks.js 12.7 kB 12.7 kB
hooks.js gzip 4.81 kB 4.81 kB
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.14 kB 8.14 kB
link.js gzip 3.49 kB 3.49 kB ⚠️ +1 B
routerDirect.js 433 B 434 B ⚠️ +1 B
routerDirect.js gzip 296 B 296 B
withRouter.js 444 B 444 B
withRouter.js gzip 294 B 294 B
Overall change ⚠️ +1 B
Client Pages Modern Overall increase ⚠️
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_app.module.js 1.73 kB 1.73 kB
_app.module.js gzip 840 B 840 B
_error.module.js 23.3 kB 23.3 kB
_error.module.js gzip 8.62 kB 8.62 kB
hooks.module.js 1.55 kB 1.55 kB
hooks.module.js gzip 804 B 805 B ⚠️ +1 B
index.module.js 319 B 319 B
index.module.js gzip 238 B 238 B
link.module.js 8.52 kB 8.52 kB
link.module.js gzip 3.68 kB 3.68 kB
routerDirect.module.js 419 B 419 B
routerDirect.module.js gzip 294 B 294 B
withRouter.module.js 429 B 430 B ⚠️ +1 B
withRouter.module.js gzip 293 B 293 B
Overall change ⚠️ +1 B
Client Build Manifests
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManifest.module.js gzip 61 B 61 B
Overall change
Rendered Page Sizes
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
index.html 3.7 kB 3.7 kB
index.html gzip 957 B 961 B ⚠️ +4 B
link.html 3.75 kB 3.75 kB
link.html gzip 965 B 968 B ⚠️ +3 B
withRouter.html 3.75 kB 3.75 kB
withRouter.html gzip 952 B 955 B ⚠️ +3 B
Overall change

Diffs

Diff for main-HASH.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[11],{
 
 /***/ "/h46":
 /***/ (function(module, exports, __webpack_require__) {
Diff for main-HASH.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[3],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[10],{
 
 /***/ "+oT+":
 /***/ (function(module, exports, __webpack_require__) {
Diff for _app.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[5],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{
 
 /***/ "B5Ud":
 /***/ (function(module, exports, __webpack_require__) {
Diff for _error.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[6],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[5],{
 
 /***/ "+iuc":
 /***/ (function(module, exports, __webpack_require__) {
Diff for hooks.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[7],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[6],{
 
 /***/ "+MDD":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
Diff for index.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[8],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[7],{
 
 /***/ "RNiq":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
Diff for link.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[9],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[8],{
 
 /***/ "/h46":
 /***/ (function(module, exports, __webpack_require__) {
Diff for routerDirect.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[10],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[9],{
 
 /***/ "LtRI":
 /***/ (function(module, exports, __webpack_require__) {
Diff for withRouter.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[11],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[10],{
 
 /***/ "0Hlz":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
Diff for _app.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[3],{
 
 /***/ "+oT+":
 /***/ (function(module, exports, __webpack_require__) {
Diff for _error.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[5],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{
 
 /***/ "+iuc":
 /***/ (function(module, exports, __webpack_require__) {
Diff for hooks.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[6],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[5],{
 
 /***/ "+MDD":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
Diff for index.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[7],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[6],{
 
 /***/ "RNiq":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
Diff for link.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[8],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[7],{
 
 /***/ "/h46":
 /***/ (function(module, exports, __webpack_require__) {
Diff for routerDirect.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[9],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[8],{
 
 /***/ "LtRI":
 /***/ (function(module, exports, __webpack_require__) {
Diff for withRouter.module.js
@@ -1,4 +1,4 @@
-(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[10],{
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[9],{
 
 /***/ "0Hlz":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
Diff for index.html
@@ -6,19 +6,19 @@
         <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"
         />
         <meta name="next-head-count" content="2" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/index.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/index.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/webpack-7928590be3ef2e55b835.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/runtime/main-3460a5729b080a2e2f54.module.js"
+        <link rel="preload" href="/_next/static/runtime/main-b34dfc4fd33bc7bccca0.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/framework.cdb73e402d876d4ac87f.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.c659a74b6088e6ac1abe.module.js"
+        <link rel="preload" href="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.c659a74b6088e6ac1abe.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -26,40 +26,40 @@
         <div id="__next">Hello world 👋</div>
         <script id="__NEXT_DATA__" type="application/json"
         crossorigin="anonymous">
-            {"dataManager":"[]","props":{"pageProps":{}},"page":"/","query":{},"buildId":"uwGH3xfJD73FhuP4LPJwT"}
+            {"dataManager":"[]","props":{"pageProps":{}},"page":"/","query":{},"buildId":"cXkwpGwYCC-o_juJxzm8i"}
         </script>
         <script crossorigin="anonymous" nomodule="">
             !function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
         </script>
-        <script async="" data-next-page="/" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/index.js"
+        <script async="" data-next-page="/" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/index.js"
         crossorigin="anonymous" nomodule=""></script>
-        <script async="" data-next-page="/" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/index.module.js"
+        <script async="" data-next-page="/" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/index.module.js"
         crossorigin="anonymous" type="module"></script>
-        <script async="" data-next-page="/_app" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.js"
+        <script async="" data-next-page="/_app" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.js"
         crossorigin="anonymous" nomodule=""></script>
-        <script async="" data-next-page="/_app" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.module.js"
+        <script async="" data-next-page="/_app" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.module.js"
         crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/webpack-a470c2a25bcb4d5a8ec0.js"
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/runtime/webpack-7928590be3ef2e55b835.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/runtime/main-6d186ce2756a9149e7e3.js"
+        <script src="/_next/static/runtime/main-2cd30e118423b74fdb03.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/runtime/main-3460a5729b080a2e2f54.module.js"
+        <script src="/_next/static/runtime/main-b34dfc4fd33bc7bccca0.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/chunks/framework.cdb73e402d876d4ac87f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/framework.cdb73e402d876d4ac87f.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/z0zo0ojQvBDZLELOgA5A0u5fVfg=.155621535702fe040780.js"
+        <script src="/_next/static/chunks/5CrX1X11jlfDoYwoFgepuHeQk5A=.155621535702fe040780.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.f6f7599a2edf91d8366a.js"
+        <script src="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.f6f7599a2edf91d8366a.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.c659a74b6088e6ac1abe.module.js"
+        <script src="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.c659a74b6088e6ac1abe.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.js"
+        <script src="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.module.js"
+        <script src="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.module.js"
         async="" crossorigin="anonymous" type="module"></script>
     </body>
Diff for link.html
@@ -6,19 +6,19 @@
         <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"
         />
         <meta name="next-head-count" content="2" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/link.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/link.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/webpack-7928590be3ef2e55b835.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/framework.cdb73e402d876d4ac87f.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.c659a74b6088e6ac1abe.module.js"
+        <link rel="preload" href="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.c659a74b6088e6ac1abe.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/runtime/main-3460a5729b080a2e2f54.module.js"
+        <link rel="preload" href="/_next/static/runtime/main-b34dfc4fd33bc7bccca0.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -29,18 +29,18 @@
             </div>
         </div>
         <script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">
-            {"dataManager":"[]","props":{"pageProps":{}},"page":"/link","query":{},"buildId":"uwGH3xfJD73FhuP4LPJwT"}
+            {"dataManager":"[]","props":{"pageProps":{}},"page":"/link","query":{},"buildId":"cXkwpGwYCC-o_juJxzm8i"}
         </script>
         <script crossorigin="anonymous" nomodule="">
             !function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
         </script>
-        <script async="" data-next-page="/link" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/link.js"
+        <script async="" data-next-page="/link" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/link.js"
         crossorigin="anonymous" nomodule=""></script>
-        <script async="" data-next-page="/link" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/link.module.js"
+        <script async="" data-next-page="/link" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/link.module.js"
         crossorigin="anonymous" type="module"></script>
-        <script async="" data-next-page="/_app" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.js"
+        <script async="" data-next-page="/_app" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.js"
         crossorigin="anonymous" nomodule=""></script>
-        <script async="" data-next-page="/_app" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.module.js"
+        <script async="" data-next-page="/_app" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.module.js"
         crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/webpack-a470c2a25bcb4d5a8ec0.js"
         async="" crossorigin="anonymous" nomodule=""></script>
@@ -50,19 +50,19 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/framework.cdb73e402d876d4ac87f.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/z0zo0ojQvBDZLELOgA5A0u5fVfg=.155621535702fe040780.js"
+        <script src="/_next/static/chunks/5CrX1X11jlfDoYwoFgepuHeQk5A=.155621535702fe040780.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.f6f7599a2edf91d8366a.js"
+        <script src="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.f6f7599a2edf91d8366a.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.c659a74b6088e6ac1abe.module.js"
+        <script src="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.c659a74b6088e6ac1abe.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/runtime/main-6d186ce2756a9149e7e3.js"
+        <script src="/_next/static/runtime/main-2cd30e118423b74fdb03.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/runtime/main-3460a5729b080a2e2f54.module.js"
+        <script src="/_next/static/runtime/main-b34dfc4fd33bc7bccca0.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.js"
+        <script src="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.module.js"
+        <script src="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.module.js"
         async="" crossorigin="anonymous" type="module"></script>
     </body>
Diff for withRouter.html
@@ -6,19 +6,19 @@
         <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"
         />
         <meta name="next-head-count" content="2" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/withRouter.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/withRouter.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/webpack-7928590be3ef2e55b835.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/framework.cdb73e402d876d4ac87f.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.c659a74b6088e6ac1abe.module.js"
+        <link rel="preload" href="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.c659a74b6088e6ac1abe.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/runtime/main-3460a5729b080a2e2f54.module.js"
+        <link rel="preload" href="/_next/static/runtime/main-b34dfc4fd33bc7bccca0.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.module.js"
+        <link rel="preload" href="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -27,18 +27,18 @@
             <div>I use withRouter</div>
         </div>
         <script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">
-            {"dataManager":"[]","props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"uwGH3xfJD73FhuP4LPJwT"}
+            {"dataManager":"[]","props":{"pageProps":{}},"page":"/withRouter","query":{},"buildId":"cXkwpGwYCC-o_juJxzm8i"}
         </script>
         <script crossorigin="anonymous" nomodule="">
             !function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
         </script>
-        <script async="" data-next-page="/withRouter" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/withRouter.js"
+        <script async="" data-next-page="/withRouter" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/withRouter.js"
         crossorigin="anonymous" nomodule=""></script>
-        <script async="" data-next-page="/withRouter" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/withRouter.module.js"
+        <script async="" data-next-page="/withRouter" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/withRouter.module.js"
         crossorigin="anonymous" type="module"></script>
-        <script async="" data-next-page="/_app" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.js"
+        <script async="" data-next-page="/_app" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.js"
         crossorigin="anonymous" nomodule=""></script>
-        <script async="" data-next-page="/_app" src="/_next/static/uwGH3xfJD73FhuP4LPJwT/pages/_app.module.js"
+        <script async="" data-next-page="/_app" src="/_next/static/cXkwpGwYCC-o_juJxzm8i/pages/_app.module.js"
         crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/webpack-a470c2a25bcb4d5a8ec0.js"
         async="" crossorigin="anonymous" nomodule=""></script>
@@ -48,19 +48,19 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/framework.cdb73e402d876d4ac87f.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/z0zo0ojQvBDZLELOgA5A0u5fVfg=.155621535702fe040780.js"
+        <script src="/_next/static/chunks/5CrX1X11jlfDoYwoFgepuHeQk5A=.155621535702fe040780.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.f6f7599a2edf91d8366a.js"
+        <script src="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.f6f7599a2edf91d8366a.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/lgsODtTdFaqKn5Y7NoncTURA8wk=.c659a74b6088e6ac1abe.module.js"
+        <script src="/_next/static/chunks/2ZogOPTiIktPmgLTsDcohY1DQQ=.c659a74b6088e6ac1abe.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/runtime/main-6d186ce2756a9149e7e3.js"
+        <script src="/_next/static/runtime/main-2cd30e118423b74fdb03.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/runtime/main-3460a5729b080a2e2f54.module.js"
+        <script src="/_next/static/runtime/main-b34dfc4fd33bc7bccca0.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.js"
+        <script src="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/uwGH3xfJD73FhuP4LPJwT/_buildManifest.module.js"
+        <script src="/_next/static/cXkwpGwYCC-o_juJxzm8i/_buildManifest.module.js"
         async="" crossorigin="anonymous" type="module"></script>
     </body>

Serverless Mode (Increase detected ⚠️)
General Overall decrease ✓
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
buildDuration 23.5s 22.8s -743ms
nodeModulesSize 41.8 MB 41.8 MB -78 B
Client Bundles (main, webpack, commons)
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.64 kB 6.64 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
Overall change
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
main-HASH.module.js 16.5 kB 16.5 kB
main-HASH.module.js gzip 6.38 kB 6.38 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
Overall change
Client Pages
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_app.js 1.83 kB 1.83 kB
_app.js gzip 884 B 884 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 12.7 kB 12.7 kB
hooks.js gzip 4.81 kB 4.81 kB
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.14 kB 8.14 kB
link.js gzip 3.49 kB 3.49 kB
routerDirect.js 433 B 433 B
routerDirect.js gzip 296 B 296 B
withRouter.js 444 B 444 B
withRouter.js gzip 294 B 294 B
Overall change
Client Pages Modern
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_app.module.js 1.73 kB 1.73 kB
_app.module.js gzip 840 B 840 B
_error.module.js 23.3 kB 23.3 kB
_error.module.js gzip 8.62 kB 8.62 kB
hooks.module.js 1.55 kB 1.55 kB
hooks.module.js gzip 804 B 804 B
index.module.js 319 B 319 B
index.module.js gzip 238 B 238 B
link.module.js 8.52 kB 8.52 kB
link.module.js gzip 3.68 kB 3.68 kB
routerDirect.module.js 419 B 419 B
routerDirect.module.js gzip 294 B 294 B
withRouter.module.js 429 B 429 B
withRouter.module.js gzip 293 B 293 B
Overall change
Client Build Manifests
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManifest.module.js gzip 61 B 61 B
Overall change
Serverless bundles Overall increase ⚠️
zeit/next.js canary Timer/next.js fix-serverless-chunking Change
_error.js 247 kB 247 kB ⚠️ +5 B
_error.js gzip 66.3 kB 66.3 kB -43 B
hooks.html 3.81 kB 3.81 kB ⚠️ +1 B
hooks.html gzip 981 B 981 B
index.js 248 kB 248 kB ⚠️ +5 B
index.js gzip 66.8 kB 66.6 kB -179 B
link.js 256 kB 256 kB ⚠️ +5 B
link.js gzip 68.8 kB 68.9 kB ⚠️ +53 B
routerDirect.js 249 kB 249 kB ⚠️ +5 B
routerDirect.js gzip 66.6 kB 66.9 kB ⚠️ +254 B
withRouter.js 249 kB 249 kB ⚠️ +5 B
withRouter.js gzip 66.6 kB 66.7 kB ⚠️ +82 B
Overall change ⚠️ +26 B

@thebuilder
Copy link

Just to be sure - When i noticed this issue, it was because I had a next.config.js with mode: 'serverless set. But you are saying it only happens when a project doesn't have a config file? Or am I it around.

module.exports = {
  target: 'serverless',
  webpack(config, { buildId, isServer, webpack }) {
    config.plugins.push(new webpack.IgnorePlugin(/^encoding$/, /node-fetch/))
    config.plugins.push(
      new webpack.DefinePlugin({
        'process.env.BUILD_ID': buildId,
        'process.env.SERVER': isServer,
        'process.env.BROWSER': !isServer,
        'process.env.IS_NEXT': true,
      }),
    )
    return config
  },
}

@Timer Timer merged commit 67e7753 into vercel:canary Aug 30, 2019
@Timer Timer deleted the fix-serverless-chunking branch August 30, 2019 11:26
@Timer
Copy link
Member Author

Timer commented Aug 30, 2019

@thebuilder were you observing that locally, or when deployed to Now? Also, were you using a monorepo setup?

There's a few things in play here.

@thebuilder
Copy link

I did a lot of debugging to try and figure out what caused it. But in the end, calling next build inside the next project would trigger it. Can't see how now would influence it?🤔

@Timer
Copy link
Member Author

Timer commented Aug 30, 2019

@thebuilder when you deploy to Now we actually ignore target: 'serverless' and switch to a much more optimized build process. 😄 This issue would've only been seen locally.

@thebuilder
Copy link

Ah! But it happens in both cases then😄

@Timer
Copy link
Member Author

Timer commented Aug 30, 2019

@thebuilder can you link me to your production deployment with the full-scale reproduction?

@thebuilder
Copy link

thebuilder commented Aug 30, 2019

I'm just working on a POC of using Next.js when I noticed the issue. Haven't really got a production site.🙂

@vercel vercel locked as resolved and limited conversation to collaborators Feb 1, 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.

9.0.5 Dynamic imports not extracted to chunks
4 participants