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

Adjust lib chunk naming algorithm and prevent duplicate react-dom #8450

Merged
merged 4 commits into from
Aug 22, 2019

Conversation

atcastle
Copy link
Collaborator

This PR fixes two problems:

  1. Duplicate react-dom modules in a bundle [Next 9] Importing react-dom would bloat the bundle size #7949. This is fixed by aliasing react-dom, and by adjusting the framework SplitChunksConfig so it applies to dynamic chunks, as well.
  2. An unreported issue where rawRequest values with relative filepaths would break the build output. To fix this, we no longer use the rawRequest property, and instead base library chunk names off of the module filepath within the node_modules directory.

let finalName = processedIdentifier && processedIdentifier[0]

finalName = finalName && finalName.split('/').join('~')
const backupName = identifier.split('/').join('~')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if the right move here is to fail gracefully (as here) or to throw. Going with the former for now, unless someone objects

Copy link
Member

Choose a reason for hiding this comment

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

Can we make this just the hashed module ID? I'm not sure there's value in trying to provide a name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why the module ID and not just the file name, as here? If it's a security issue (ie we're worried about exposing any information about the file structure of the machine that built the app) then we'd have to use something other than the fast SHA1 we're using for hashes. I tend not to think that would actually be a security issue, though, and this backup shouldn't actually get used for any properly formed module filepath.

Copy link
Member

Choose a reason for hiding this comment

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

Just so we can shed all of this logic stripping node_modules, etc. Webpack already generates an ID for us so I figured it'd be better to rely on it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not exactly sure why, but in the name() callback, module.id has a value of null. The module.identifier() method returns the file path. Was there a different way you were thinking of to access an ID?

Copy link
Member

@Timer Timer Aug 21, 2019

Choose a reason for hiding this comment

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

Hmm, module.id is dependent on the chunk graph so the ID I'd like to use isn't available yet. 😞

Looks like we could call module.libIdent({ context: dir }) though instead of module.identifier() and get an already-relative path.

Maybe we could replace all of this with something like:

	name(module: { libIdent: Function }): string {
		return crypto
			.createHash("sha1")
			.update(module.libIdent({ context: dir }))
			.digest("hex")
			.substring(0, 8);
	}

Note this is probably all likely to change with the webpack 5 upgrade.

@Timer Timer added this to the 9.0.5 milestone Aug 20, 2019
@ijjk
Copy link
Member

ijjk commented Aug 20, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 25.2s 25.2s ⚠️ +68ms
nodeModulesSize 41.2 MB 41.3 MB ⚠️ +46.6 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 17.8 kB 17.9 kB ⚠️ +107 B
main-HASH.js gzip 6.54 kB 6.56 kB ⚠️ +22 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
commons.HASH.js 190 kB 190 kB
commons.HASH.js gzip 61.6 kB 61.6 kB
Overall change ⚠️ +107 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.1 kB 16.2 kB ⚠️ +61 B
main-HASH.module.js gzip 6.27 kB 6.28 kB ⚠️ +10 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
commons.HASH.module.js 171 kB 171 kB
commons.HASH.module.js gzip 55.4 kB 55.4 kB
Overall change ⚠️ +61 B
Client Pages
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 905 B 905 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 1.06 kB 1.06 kB
hooks.js gzip 601 B 600 B -1 B
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.13 kB 8.13 kB
link.js gzip 3.49 kB 3.49 kB ⚠️ +1 B
routerDirect.js 429 B 429 B
routerDirect.js gzip 292 B 292 B
withRouter.js 439 B 439 B
withRouter.js gzip 289 B 290 B ⚠️ +1 B
Overall change
Client Pages Modern
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 865 B 865 B
_error.module.js 10.6 kB 10.6 kB
_error.module.js gzip 4.31 kB 4.31 kB
hooks.module.js 596 B 596 B
hooks.module.js gzip 354 B 354 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.67 kB 3.67 kB
routerDirect.module.js 417 B 417 B
routerDirect.module.js gzip 292 B 292 B
withRouter.module.js 427 B 427 B
withRouter.module.js gzip 291 B 291 B
Overall change
Fetched pages Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
link 2.78 kB 2.8 kB ⚠️ +23 B
link gzip 835 B 847 B ⚠️ +12 B
index 2.73 kB 2.75 kB ⚠️ +23 B
index gzip 825 B 839 B ⚠️ +14 B
withRouter 2.79 kB 2.81 kB ⚠️ +23 B
withRouter gzip 823 B 835 B ⚠️ +12 B
Overall change ⚠️ +69 B

Diffs

Diff for main-HASH.js
@@ -343,6 +343,7 @@ var props = data.props,
     page = data.page,
     query = data.query,
     buildId = data.buildId,
+    dynamicBuildId = data.dynamicBuildId,
     assetPrefix = data.assetPrefix,
     runtimeConfig = data.runtimeConfig,
     dynamicIds = data.dynamicIds;
@@ -515,6 +516,8 @@ function () {
             return window.__NEXT_PRELOADREADY(dynamicIds);
 
           case 22:
+            if (false) {}
+
             exports.router = router = (0, _router.createRouter)(page, query, asPath, {
               initialProps: props,
               pageLoader: pageLoader,
@@ -545,7 +548,7 @@ function () {
             render(renderCtx);
             return _context.abrupt("return", emitter);
 
-          case 26:
+          case 27:
           case "end":
             return _context.stop();
         }
@@ -1432,6 +1435,8 @@ var PageLoader =
 /*#__PURE__*/
 function () {
   function PageLoader(buildId, assetPrefix) {
+    var _this3 = this;
+
     _classCallCheck(this, PageLoader);
 
     this.buildId = buildId;
@@ -1439,6 +1444,9 @@ function () {
     this.pageCache = {};
     this.pageRegisterEvents = (0, _mitt["default"])();
     this.loadingRoutes = {};
+    this.promisedBuildId = _promise["default"].resolve();
+
+    if (false) {}
 
     if (false) {}
   } // Returns a promise for the dependencies for a particular route
@@ -1467,7 +1475,7 @@ function () {
   }, {
     key: "loadPage",
     value: function loadPage(route) {
-      var _this3 = this;
+      var _this4 = this;
 
       route = this.normalizeRoute(route);
       return new _promise["default"](function (resolve, reject) {
@@ -1475,9 +1483,9 @@ function () {
           var error = _ref.error,
               page = _ref.page;
 
-          _this3.pageRegisterEvents.off(route, fire);
+          _this4.pageRegisterEvents.off(route, fire);
 
-          delete _this3.loadingRoutes[route];
+          delete _this4.loadingRoutes[route];
 
           if (error) {
             reject(error);
@@ -1487,7 +1495,7 @@ function () {
         }; // If there's a cached version of the page, let's use it.
 
 
-        var cachedPage = _this3.pageCache[route];
+        var cachedPage = _this4.pageCache[route];
 
         if (cachedPage) {
           var error = cachedPage.error,
@@ -1497,7 +1505,7 @@ function () {
         } // Register a listener to get the page
 
 
-        _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+        _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
         // rather downloading it again.
 
 
@@ -1505,11 +1513,11 @@ function () {
           return;
         }
 
-        if (!_this3.loadingRoutes[route]) {
+        if (!_this4.loadingRoutes[route]) {
           if (false) {} else {
-            _this3.loadRoute(route);
+            _this4.loadRoute(route);
 
-            _this3.loadingRoutes[route] = true;
+            _this4.loadingRoutes[route] = true;
           }
         }
       });
@@ -1527,13 +1535,22 @@ function () {
           while (1) {
             switch (_context.prev = _context.next) {
               case 0:
+                if (true) {
+                  _context.next = 3;
+                  break;
+                }
+
+                _context.next = 3;
+                return _this.promisedBuildId;
+
+              case 3:
                 route = _this.normalizeRoute(route);
                 scriptRoute = route === '/' ? '/index.js' : route + ".js";
                 url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
 
                 _this.loadScript(url, route, true);
 
-              case 4:
+              case 7:
               case "end":
                 return _context.stop();
             }
@@ -1544,7 +1561,7 @@ function () {
   }, {
     key: "loadScript",
     value: function loadScript(url, route, isPage) {
-      var _this4 = this;
+      var _this5 = this;
 
       var script = document.createElement('script');
 
@@ -1562,7 +1579,7 @@ function () {
         var error = new Error("Error loading script " + url);
         error.code = 'PAGE_LOAD_ERROR';
 
-        _this4.pageRegisterEvents.emit(route, {
+        _this5.pageRegisterEvents.emit(route, {
           error: error
         });
       };
@@ -1573,7 +1590,7 @@ function () {
   }, {
     key: "registerPage",
     value: function registerPage(route, regFn) {
-      var _this5 = this;
+      var _this6 = this;
 
       var register = function register() {
         try {
@@ -1581,21 +1598,21 @@ function () {
               error = _regFn.error,
               page = _regFn.page;
 
-          _this5.pageCache[route] = {
+          _this6.pageCache[route] = {
             error: error,
             page: page
           };
 
-          _this5.pageRegisterEvents.emit(route, {
+          _this6.pageRegisterEvents.emit(route, {
             error: error,
             page: page
           });
         } catch (error) {
-          _this5.pageCache[route] = {
+          _this6.pageCache[route] = {
             error: error
           };
 
-          _this5.pageRegisterEvents.emit(route, {
+          _this6.pageRegisterEvents.emit(route, {
             error: error
           });
         }
@@ -1618,6 +1635,15 @@ function () {
           while (1) {
             switch (_context2.prev = _context2.next) {
               case 0:
+                if (true) {
+                  _context2.next = 3;
+                  break;
+                }
+
+                _context2.next = 3;
+                return _this2.promisedBuildId;
+
+              case 3:
                 route = _this2.normalizeRoute(route);
                 scriptRoute = (route === '/' ? '/index' : route) + ".js";
 
@@ -1629,68 +1655,68 @@ function () {
                 // its own deduping mechanism.
 
                 if (!document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
-                  _context2.next = 6;
+                  _context2.next = 9;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 6:
+              case 9:
                 if (!(cn = navigator.connection)) {
-                  _context2.next = 9;
+                  _context2.next = 12;
                   break;
                 }
 
                 if (!((cn.effectiveType || '').indexOf('2g') !== -1 || cn.saveData)) {
-                  _context2.next = 9;
+                  _context2.next = 12;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 9:
+              case 12:
                 if (true) {
-                  _context2.next = 15;
+                  _context2.next = 18;
                   break;
                 }
 
                 ;
-                _context2.next = 13;
+                _context2.next = 16;
                 return _this2.getDependencies(route);
 
-              case 13:
+              case 16:
                 _context2.t0 = function (url) {
                   _this2.prefetch(url, true);
                 };
 
                 _context2.sent.forEach(_context2.t0);
 
-              case 15:
+              case 18:
                 if (!hasPreload) {
-                  _context2.next = 18;
+                  _context2.next = 21;
                   break;
                 }
 
                 preloadScript(url);
                 return _context2.abrupt("return");
 
-              case 18:
+              case 21:
                 if (!isDependency) {
-                  _context2.next = 20;
+                  _context2.next = 23;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 20:
+              case 23:
                 if (!(document.readyState === 'complete')) {
-                  _context2.next = 24;
+                  _context2.next = 27;
                   break;
                 }
 
                 return _context2.abrupt("return", _this2.loadPage(route)["catch"](function () {}));
 
-              case 24:
+              case 27:
                 return _context2.abrupt("return", new _promise["default"](function (resolve) {
                   window.addEventListener('load', function () {
                     _this2.loadPage(route).then(function () {
@@ -1701,7 +1727,7 @@ function () {
                   });
                 }));
 
-              case 25:
+              case 28:
               case "end":
                 return _context2.stop();
             }
Diff for main-HASH.module.js
@@ -416,6 +416,7 @@ const {
   page,
   query,
   buildId,
+  dynamicBuildId,
   assetPrefix,
   runtimeConfig,
   dynamicIds
@@ -530,6 +531,8 @@ function () {
       yield window.__NEXT_PRELOADREADY(dynamicIds);
     }
 
+    if (false) {}
+
     exports.router = router = (0, _router.createRouter)(page, query, asPath, {
       initialProps: props,
       pageLoader,
@@ -1348,6 +1351,9 @@ class PageLoader {
     this.pageCache = {};
     this.pageRegisterEvents = (0, _mitt.default)();
     this.loadingRoutes = {};
+    this.promisedBuildId = _promise.default.resolve();
+
+    if (false) {}
 
     if (false) {}
   } // Returns a promise for the dependencies for a particular route
@@ -1418,6 +1424,8 @@ class PageLoader {
     var _this = this;
 
     return (0, _asyncToGenerator2.default)(function* () {
+      if (false) {}
+
       route = _this.normalizeRoute(route);
       let scriptRoute = route === '/' ? '/index.js' : route + ".js";
       const url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
@@ -1485,6 +1493,8 @@ class PageLoader {
     var _this2 = this;
 
     return (0, _asyncToGenerator2.default)(function* () {
+      if (false) {}
+
       route = _this2.normalizeRoute(route);
       let scriptRoute = (route === '/' ? '/index' : route) + ".js";

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 26.9s 27.4s ⚠️ +554ms
nodeModulesSize 41.2 MB 41.3 MB ⚠️ +46.6 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 17.8 kB 17.9 kB ⚠️ +107 B
main-HASH.js gzip 6.54 kB 6.56 kB ⚠️ +22 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
commons.HASH.js 190 kB 190 kB
commons.HASH.js gzip 61.6 kB 61.6 kB
Overall change ⚠️ +107 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.1 kB 16.2 kB ⚠️ +61 B
main-HASH.module.js gzip 6.27 kB 6.28 kB ⚠️ +9 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
commons.HASH.module.js 171 kB 171 kB
commons.HASH.module.js gzip 55.4 kB 55.4 kB
Overall change ⚠️ +61 B
Client Pages
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 905 B 905 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 1.06 kB 1.06 kB
hooks.js gzip 600 B 600 B
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.13 kB 8.13 kB
link.js gzip 3.49 kB 3.49 kB
routerDirect.js 429 B 429 B
routerDirect.js gzip 292 B 292 B
withRouter.js 439 B 439 B
withRouter.js gzip 290 B 290 B
Overall change
Client Pages Modern
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 865 B 865 B
_error.module.js 10.6 kB 10.6 kB
_error.module.js gzip 4.31 kB 4.31 kB
hooks.module.js 596 B 596 B
hooks.module.js gzip 354 B 354 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.67 kB 3.67 kB
routerDirect.module.js 417 B 417 B
routerDirect.module.js gzip 292 B 292 B
withRouter.module.js 427 B 427 B
withRouter.module.js gzip 291 B 291 B
Overall change
Serverless bundles Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_error.js 247 kB 247 kB ⚠️ +730 B
_error.js gzip 66.1 kB 66.3 kB ⚠️ +167 B
hooks.html 2.85 kB 2.87 kB ⚠️ +23 B
hooks.html gzip 852 B 864 B ⚠️ +12 B
index.js 247 kB 248 kB ⚠️ +675 B
index.js gzip 66.5 kB 66.6 kB ⚠️ +109 B
link.js 255 kB 255 kB ⚠️ +675 B
link.js gzip 68.7 kB 68.8 kB ⚠️ +69 B
routerDirect.js 248 kB 248 kB ⚠️ +675 B
routerDirect.js gzip 66.4 kB 66.5 kB ⚠️ +148 B
withRouter.js 248 kB 248 kB ⚠️ +675 B
withRouter.js gzip 66.5 kB 66.6 kB ⚠️ +155 B
Overall change ⚠️ +3.45 kB

@ijjk
Copy link
Member

ijjk commented Aug 20, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 24.2s 25.1s ⚠️ +837ms
nodeModulesSize 41.2 MB 41.3 MB ⚠️ +45.5 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 17.8 kB 17.9 kB ⚠️ +107 B
main-HASH.js gzip 6.54 kB 6.56 kB ⚠️ +22 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
commons.HASH.js 190 kB 190 kB
commons.HASH.js gzip 61.6 kB 61.6 kB
Overall change ⚠️ +107 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.1 kB 16.2 kB ⚠️ +61 B
main-HASH.module.js gzip 6.27 kB 6.28 kB ⚠️ +9 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
commons.HASH.module.js 171 kB 171 kB
commons.HASH.module.js gzip 55.4 kB 55.4 kB
Overall change ⚠️ +61 B
Client Pages
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 905 B 905 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 1.06 kB 1.06 kB
hooks.js gzip 600 B 600 B
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.13 kB 8.13 kB
link.js gzip 3.49 kB 3.49 kB
routerDirect.js 429 B 429 B
routerDirect.js gzip 292 B 292 B
withRouter.js 439 B 439 B
withRouter.js gzip 290 B 290 B
Overall change
Client Pages Modern
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 865 B 865 B
_error.module.js 10.6 kB 10.6 kB
_error.module.js gzip 4.31 kB 4.31 kB
hooks.module.js 596 B 596 B
hooks.module.js gzip 354 B 354 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.67 kB 3.67 kB
routerDirect.module.js 417 B 417 B
routerDirect.module.js gzip 292 B 292 B
withRouter.module.js 427 B 427 B
withRouter.module.js gzip 291 B 291 B
Overall change
Fetched pages Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
link 2.78 kB 2.8 kB ⚠️ +23 B
link gzip 835 B 850 B ⚠️ +15 B
index 2.73 kB 2.75 kB ⚠️ +23 B
index gzip 824 B 842 B ⚠️ +18 B
withRouter 2.79 kB 2.81 kB ⚠️ +23 B
withRouter gzip 822 B 835 B ⚠️ +13 B
Overall change ⚠️ +69 B

Diffs

Diff for main-HASH.js
@@ -343,6 +343,7 @@ var props = data.props,
     page = data.page,
     query = data.query,
     buildId = data.buildId,
+    dynamicBuildId = data.dynamicBuildId,
     assetPrefix = data.assetPrefix,
     runtimeConfig = data.runtimeConfig,
     dynamicIds = data.dynamicIds;
@@ -515,6 +516,8 @@ function () {
             return window.__NEXT_PRELOADREADY(dynamicIds);
 
           case 22:
+            if (false) {}
+
             exports.router = router = (0, _router.createRouter)(page, query, asPath, {
               initialProps: props,
               pageLoader: pageLoader,
@@ -545,7 +548,7 @@ function () {
             render(renderCtx);
             return _context.abrupt("return", emitter);
 
-          case 26:
+          case 27:
           case "end":
             return _context.stop();
         }
@@ -1432,6 +1435,8 @@ var PageLoader =
 /*#__PURE__*/
 function () {
   function PageLoader(buildId, assetPrefix) {
+    var _this3 = this;
+
     _classCallCheck(this, PageLoader);
 
     this.buildId = buildId;
@@ -1439,6 +1444,9 @@ function () {
     this.pageCache = {};
     this.pageRegisterEvents = (0, _mitt["default"])();
     this.loadingRoutes = {};
+    this.promisedBuildId = _promise["default"].resolve();
+
+    if (false) {}
 
     if (false) {}
   } // Returns a promise for the dependencies for a particular route
@@ -1467,7 +1475,7 @@ function () {
   }, {
     key: "loadPage",
     value: function loadPage(route) {
-      var _this3 = this;
+      var _this4 = this;
 
       route = this.normalizeRoute(route);
       return new _promise["default"](function (resolve, reject) {
@@ -1475,9 +1483,9 @@ function () {
           var error = _ref.error,
               page = _ref.page;
 
-          _this3.pageRegisterEvents.off(route, fire);
+          _this4.pageRegisterEvents.off(route, fire);
 
-          delete _this3.loadingRoutes[route];
+          delete _this4.loadingRoutes[route];
 
           if (error) {
             reject(error);
@@ -1487,7 +1495,7 @@ function () {
         }; // If there's a cached version of the page, let's use it.
 
 
-        var cachedPage = _this3.pageCache[route];
+        var cachedPage = _this4.pageCache[route];
 
         if (cachedPage) {
           var error = cachedPage.error,
@@ -1497,7 +1505,7 @@ function () {
         } // Register a listener to get the page
 
 
-        _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+        _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
         // rather downloading it again.
 
 
@@ -1505,11 +1513,11 @@ function () {
           return;
         }
 
-        if (!_this3.loadingRoutes[route]) {
+        if (!_this4.loadingRoutes[route]) {
           if (false) {} else {
-            _this3.loadRoute(route);
+            _this4.loadRoute(route);
 
-            _this3.loadingRoutes[route] = true;
+            _this4.loadingRoutes[route] = true;
           }
         }
       });
@@ -1527,13 +1535,22 @@ function () {
           while (1) {
             switch (_context.prev = _context.next) {
               case 0:
+                if (true) {
+                  _context.next = 3;
+                  break;
+                }
+
+                _context.next = 3;
+                return _this.promisedBuildId;
+
+              case 3:
                 route = _this.normalizeRoute(route);
                 scriptRoute = route === '/' ? '/index.js' : route + ".js";
                 url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
 
                 _this.loadScript(url, route, true);
 
-              case 4:
+              case 7:
               case "end":
                 return _context.stop();
             }
@@ -1544,7 +1561,7 @@ function () {
   }, {
     key: "loadScript",
     value: function loadScript(url, route, isPage) {
-      var _this4 = this;
+      var _this5 = this;
 
       var script = document.createElement('script');
 
@@ -1562,7 +1579,7 @@ function () {
         var error = new Error("Error loading script " + url);
         error.code = 'PAGE_LOAD_ERROR';
 
-        _this4.pageRegisterEvents.emit(route, {
+        _this5.pageRegisterEvents.emit(route, {
           error: error
         });
       };
@@ -1573,7 +1590,7 @@ function () {
   }, {
     key: "registerPage",
     value: function registerPage(route, regFn) {
-      var _this5 = this;
+      var _this6 = this;
 
       var register = function register() {
         try {
@@ -1581,21 +1598,21 @@ function () {
               error = _regFn.error,
               page = _regFn.page;
 
-          _this5.pageCache[route] = {
+          _this6.pageCache[route] = {
             error: error,
             page: page
           };
 
-          _this5.pageRegisterEvents.emit(route, {
+          _this6.pageRegisterEvents.emit(route, {
             error: error,
             page: page
           });
         } catch (error) {
-          _this5.pageCache[route] = {
+          _this6.pageCache[route] = {
             error: error
           };
 
-          _this5.pageRegisterEvents.emit(route, {
+          _this6.pageRegisterEvents.emit(route, {
             error: error
           });
         }
@@ -1618,6 +1635,15 @@ function () {
           while (1) {
             switch (_context2.prev = _context2.next) {
               case 0:
+                if (true) {
+                  _context2.next = 3;
+                  break;
+                }
+
+                _context2.next = 3;
+                return _this2.promisedBuildId;
+
+              case 3:
                 route = _this2.normalizeRoute(route);
                 scriptRoute = (route === '/' ? '/index' : route) + ".js";
 
@@ -1629,68 +1655,68 @@ function () {
                 // its own deduping mechanism.
 
                 if (!document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
-                  _context2.next = 6;
+                  _context2.next = 9;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 6:
+              case 9:
                 if (!(cn = navigator.connection)) {
-                  _context2.next = 9;
+                  _context2.next = 12;
                   break;
                 }
 
                 if (!((cn.effectiveType || '').indexOf('2g') !== -1 || cn.saveData)) {
-                  _context2.next = 9;
+                  _context2.next = 12;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 9:
+              case 12:
                 if (true) {
-                  _context2.next = 15;
+                  _context2.next = 18;
                   break;
                 }
 
                 ;
-                _context2.next = 13;
+                _context2.next = 16;
                 return _this2.getDependencies(route);
 
-              case 13:
+              case 16:
                 _context2.t0 = function (url) {
                   _this2.prefetch(url, true);
                 };
 
                 _context2.sent.forEach(_context2.t0);
 
-              case 15:
+              case 18:
                 if (!hasPreload) {
-                  _context2.next = 18;
+                  _context2.next = 21;
                   break;
                 }
 
                 preloadScript(url);
                 return _context2.abrupt("return");
 
-              case 18:
+              case 21:
                 if (!isDependency) {
-                  _context2.next = 20;
+                  _context2.next = 23;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 20:
+              case 23:
                 if (!(document.readyState === 'complete')) {
-                  _context2.next = 24;
+                  _context2.next = 27;
                   break;
                 }
 
                 return _context2.abrupt("return", _this2.loadPage(route)["catch"](function () {}));
 
-              case 24:
+              case 27:
                 return _context2.abrupt("return", new _promise["default"](function (resolve) {
                   window.addEventListener('load', function () {
                     _this2.loadPage(route).then(function () {
@@ -1701,7 +1727,7 @@ function () {
                   });
                 }));
 
-              case 25:
+              case 28:
               case "end":
                 return _context2.stop();
             }
Diff for main-HASH.module.js
@@ -416,6 +416,7 @@ const {
   page,
   query,
   buildId,
+  dynamicBuildId,
   assetPrefix,
   runtimeConfig,
   dynamicIds
@@ -530,6 +531,8 @@ function () {
       yield window.__NEXT_PRELOADREADY(dynamicIds);
     }
 
+    if (false) {}
+
     exports.router = router = (0, _router.createRouter)(page, query, asPath, {
       initialProps: props,
       pageLoader,
@@ -1348,6 +1351,9 @@ class PageLoader {
     this.pageCache = {};
     this.pageRegisterEvents = (0, _mitt.default)();
     this.loadingRoutes = {};
+    this.promisedBuildId = _promise.default.resolve();
+
+    if (false) {}
 
     if (false) {}
   } // Returns a promise for the dependencies for a particular route
@@ -1418,6 +1424,8 @@ class PageLoader {
     var _this = this;
 
     return (0, _asyncToGenerator2.default)(function* () {
+      if (false) {}
+
       route = _this.normalizeRoute(route);
       let scriptRoute = route === '/' ? '/index.js' : route + ".js";
       const url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
@@ -1485,6 +1493,8 @@ class PageLoader {
     var _this2 = this;
 
     return (0, _asyncToGenerator2.default)(function* () {
+      if (false) {}
+
       route = _this2.normalizeRoute(route);
       let scriptRoute = (route === '/' ? '/index' : route) + ".js";

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 26.5s 27.4s ⚠️ +882ms
nodeModulesSize 41.2 MB 41.3 MB ⚠️ +45.5 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 17.8 kB 17.9 kB ⚠️ +107 B
main-HASH.js gzip 6.54 kB 6.56 kB ⚠️ +22 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
commons.HASH.js 190 kB 190 kB
commons.HASH.js gzip 61.6 kB 61.6 kB
Overall change ⚠️ +107 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.1 kB 16.2 kB ⚠️ +61 B
main-HASH.module.js gzip 6.27 kB 6.28 kB ⚠️ +8 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
commons.HASH.module.js 171 kB 171 kB
commons.HASH.module.js gzip 55.4 kB 55.4 kB
Overall change ⚠️ +61 B
Client Pages
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 905 B 905 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 1.06 kB 1.06 kB
hooks.js gzip 600 B 601 B ⚠️ +1 B
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.13 kB 8.13 kB
link.js gzip 3.49 kB 3.49 kB -1 B
routerDirect.js 429 B 429 B
routerDirect.js gzip 292 B 292 B
withRouter.js 439 B 439 B
withRouter.js gzip 290 B 289 B -1 B
Overall change
Client Pages Modern
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 865 B 865 B
_error.module.js 10.6 kB 10.6 kB
_error.module.js gzip 4.31 kB 4.31 kB
hooks.module.js 596 B 596 B
hooks.module.js gzip 354 B 354 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.67 kB 3.67 kB
routerDirect.module.js 417 B 417 B
routerDirect.module.js gzip 292 B 292 B
withRouter.module.js 427 B 427 B
withRouter.module.js gzip 291 B 291 B
Overall change
Serverless bundles Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_error.js 247 kB 247 kB ⚠️ +730 B
_error.js gzip 66 kB 66.3 kB ⚠️ +249 B
hooks.html 2.85 kB 2.87 kB ⚠️ +23 B
hooks.html gzip 851 B 866 B ⚠️ +15 B
index.js 247 kB 248 kB ⚠️ +675 B
index.js gzip 66.5 kB 66.6 kB ⚠️ +84 B
link.js 255 kB 255 kB ⚠️ +675 B
link.js gzip 68.6 kB 68.8 kB ⚠️ +181 B
routerDirect.js 248 kB 248 kB ⚠️ +675 B
routerDirect.js gzip 66.7 kB 66.5 kB -129 B
withRouter.js 248 kB 248 kB ⚠️ +675 B
withRouter.js gzip 66.5 kB 66.6 kB ⚠️ +145 B
Overall change ⚠️ +3.45 kB

@ijjk
Copy link
Member

ijjk commented Aug 20, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 24.7s 25.2s ⚠️ +558ms
nodeModulesSize 41.2 MB 41.3 MB ⚠️ +45.9 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 17.8 kB 17.9 kB ⚠️ +107 B
main-HASH.js gzip 6.54 kB 6.56 kB ⚠️ +22 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
commons.HASH.js 190 kB 190 kB
commons.HASH.js gzip 61.6 kB 61.6 kB
Overall change ⚠️ +107 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.1 kB 16.2 kB ⚠️ +61 B
main-HASH.module.js gzip 6.27 kB 6.28 kB ⚠️ +10 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
commons.HASH.module.js 171 kB 171 kB
commons.HASH.module.js gzip 55.4 kB 55.4 kB
Overall change ⚠️ +61 B
Client Pages
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 905 B 905 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 1.06 kB 1.06 kB
hooks.js gzip 601 B 600 B -1 B
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.13 kB 8.13 kB
link.js gzip 3.49 kB 3.49 kB ⚠️ +1 B
routerDirect.js 429 B 429 B
routerDirect.js gzip 292 B 292 B
withRouter.js 439 B 439 B
withRouter.js gzip 289 B 290 B ⚠️ +1 B
Overall change
Client Pages Modern
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 865 B 865 B
_error.module.js 10.6 kB 10.6 kB
_error.module.js gzip 4.31 kB 4.31 kB
hooks.module.js 596 B 596 B
hooks.module.js gzip 354 B 354 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.67 kB 3.67 kB
routerDirect.module.js 417 B 417 B
routerDirect.module.js gzip 292 B 292 B
withRouter.module.js 427 B 427 B
withRouter.module.js gzip 291 B 291 B
Overall change
Fetched pages Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
link 2.78 kB 2.8 kB ⚠️ +23 B
link gzip 838 B 848 B ⚠️ +10 B
index 2.73 kB 2.75 kB ⚠️ +23 B
index gzip 826 B 841 B ⚠️ +15 B
withRouter 2.79 kB 2.81 kB ⚠️ +23 B
withRouter gzip 825 B 836 B ⚠️ +11 B
Overall change ⚠️ +69 B

Diffs

Diff for main-HASH.js
@@ -343,6 +343,7 @@ var props = data.props,
     page = data.page,
     query = data.query,
     buildId = data.buildId,
+    dynamicBuildId = data.dynamicBuildId,
     assetPrefix = data.assetPrefix,
     runtimeConfig = data.runtimeConfig,
     dynamicIds = data.dynamicIds;
@@ -515,6 +516,8 @@ function () {
             return window.__NEXT_PRELOADREADY(dynamicIds);
 
           case 22:
+            if (false) {}
+
             exports.router = router = (0, _router.createRouter)(page, query, asPath, {
               initialProps: props,
               pageLoader: pageLoader,
@@ -545,7 +548,7 @@ function () {
             render(renderCtx);
             return _context.abrupt("return", emitter);
 
-          case 26:
+          case 27:
           case "end":
             return _context.stop();
         }
@@ -1432,6 +1435,8 @@ var PageLoader =
 /*#__PURE__*/
 function () {
   function PageLoader(buildId, assetPrefix) {
+    var _this3 = this;
+
     _classCallCheck(this, PageLoader);
 
     this.buildId = buildId;
@@ -1439,6 +1444,9 @@ function () {
     this.pageCache = {};
     this.pageRegisterEvents = (0, _mitt["default"])();
     this.loadingRoutes = {};
+    this.promisedBuildId = _promise["default"].resolve();
+
+    if (false) {}
 
     if (false) {}
   } // Returns a promise for the dependencies for a particular route
@@ -1467,7 +1475,7 @@ function () {
   }, {
     key: "loadPage",
     value: function loadPage(route) {
-      var _this3 = this;
+      var _this4 = this;
 
       route = this.normalizeRoute(route);
       return new _promise["default"](function (resolve, reject) {
@@ -1475,9 +1483,9 @@ function () {
           var error = _ref.error,
               page = _ref.page;
 
-          _this3.pageRegisterEvents.off(route, fire);
+          _this4.pageRegisterEvents.off(route, fire);
 
-          delete _this3.loadingRoutes[route];
+          delete _this4.loadingRoutes[route];
 
           if (error) {
             reject(error);
@@ -1487,7 +1495,7 @@ function () {
         }; // If there's a cached version of the page, let's use it.
 
 
-        var cachedPage = _this3.pageCache[route];
+        var cachedPage = _this4.pageCache[route];
 
         if (cachedPage) {
           var error = cachedPage.error,
@@ -1497,7 +1505,7 @@ function () {
         } // Register a listener to get the page
 
 
-        _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+        _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
         // rather downloading it again.
 
 
@@ -1505,11 +1513,11 @@ function () {
           return;
         }
 
-        if (!_this3.loadingRoutes[route]) {
+        if (!_this4.loadingRoutes[route]) {
           if (false) {} else {
-            _this3.loadRoute(route);
+            _this4.loadRoute(route);
 
-            _this3.loadingRoutes[route] = true;
+            _this4.loadingRoutes[route] = true;
           }
         }
       });
@@ -1527,13 +1535,22 @@ function () {
           while (1) {
             switch (_context.prev = _context.next) {
               case 0:
+                if (true) {
+                  _context.next = 3;
+                  break;
+                }
+
+                _context.next = 3;
+                return _this.promisedBuildId;
+
+              case 3:
                 route = _this.normalizeRoute(route);
                 scriptRoute = route === '/' ? '/index.js' : route + ".js";
                 url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
 
                 _this.loadScript(url, route, true);
 
-              case 4:
+              case 7:
               case "end":
                 return _context.stop();
             }
@@ -1544,7 +1561,7 @@ function () {
   }, {
     key: "loadScript",
     value: function loadScript(url, route, isPage) {
-      var _this4 = this;
+      var _this5 = this;
 
       var script = document.createElement('script');
 
@@ -1562,7 +1579,7 @@ function () {
         var error = new Error("Error loading script " + url);
         error.code = 'PAGE_LOAD_ERROR';
 
-        _this4.pageRegisterEvents.emit(route, {
+        _this5.pageRegisterEvents.emit(route, {
           error: error
         });
       };
@@ -1573,7 +1590,7 @@ function () {
   }, {
     key: "registerPage",
     value: function registerPage(route, regFn) {
-      var _this5 = this;
+      var _this6 = this;
 
       var register = function register() {
         try {
@@ -1581,21 +1598,21 @@ function () {
               error = _regFn.error,
               page = _regFn.page;
 
-          _this5.pageCache[route] = {
+          _this6.pageCache[route] = {
             error: error,
             page: page
           };
 
-          _this5.pageRegisterEvents.emit(route, {
+          _this6.pageRegisterEvents.emit(route, {
             error: error,
             page: page
           });
         } catch (error) {
-          _this5.pageCache[route] = {
+          _this6.pageCache[route] = {
             error: error
           };
 
-          _this5.pageRegisterEvents.emit(route, {
+          _this6.pageRegisterEvents.emit(route, {
             error: error
           });
         }
@@ -1618,6 +1635,15 @@ function () {
           while (1) {
             switch (_context2.prev = _context2.next) {
               case 0:
+                if (true) {
+                  _context2.next = 3;
+                  break;
+                }
+
+                _context2.next = 3;
+                return _this2.promisedBuildId;
+
+              case 3:
                 route = _this2.normalizeRoute(route);
                 scriptRoute = (route === '/' ? '/index' : route) + ".js";
 
@@ -1629,68 +1655,68 @@ function () {
                 // its own deduping mechanism.
 
                 if (!document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
-                  _context2.next = 6;
+                  _context2.next = 9;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 6:
+              case 9:
                 if (!(cn = navigator.connection)) {
-                  _context2.next = 9;
+                  _context2.next = 12;
                   break;
                 }
 
                 if (!((cn.effectiveType || '').indexOf('2g') !== -1 || cn.saveData)) {
-                  _context2.next = 9;
+                  _context2.next = 12;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 9:
+              case 12:
                 if (true) {
-                  _context2.next = 15;
+                  _context2.next = 18;
                   break;
                 }
 
                 ;
-                _context2.next = 13;
+                _context2.next = 16;
                 return _this2.getDependencies(route);
 
-              case 13:
+              case 16:
                 _context2.t0 = function (url) {
                   _this2.prefetch(url, true);
                 };
 
                 _context2.sent.forEach(_context2.t0);
 
-              case 15:
+              case 18:
                 if (!hasPreload) {
-                  _context2.next = 18;
+                  _context2.next = 21;
                   break;
                 }
 
                 preloadScript(url);
                 return _context2.abrupt("return");
 
-              case 18:
+              case 21:
                 if (!isDependency) {
-                  _context2.next = 20;
+                  _context2.next = 23;
                   break;
                 }
 
                 return _context2.abrupt("return");
 
-              case 20:
+              case 23:
                 if (!(document.readyState === 'complete')) {
-                  _context2.next = 24;
+                  _context2.next = 27;
                   break;
                 }
 
                 return _context2.abrupt("return", _this2.loadPage(route)["catch"](function () {}));
 
-              case 24:
+              case 27:
                 return _context2.abrupt("return", new _promise["default"](function (resolve) {
                   window.addEventListener('load', function () {
                     _this2.loadPage(route).then(function () {
@@ -1701,7 +1727,7 @@ function () {
                   });
                 }));
 
-              case 25:
+              case 28:
               case "end":
                 return _context2.stop();
             }
Diff for main-HASH.module.js
@@ -416,6 +416,7 @@ const {
   page,
   query,
   buildId,
+  dynamicBuildId,
   assetPrefix,
   runtimeConfig,
   dynamicIds
@@ -530,6 +531,8 @@ function () {
       yield window.__NEXT_PRELOADREADY(dynamicIds);
     }
 
+    if (false) {}
+
     exports.router = router = (0, _router.createRouter)(page, query, asPath, {
       initialProps: props,
       pageLoader,
@@ -1348,6 +1351,9 @@ class PageLoader {
     this.pageCache = {};
     this.pageRegisterEvents = (0, _mitt.default)();
     this.loadingRoutes = {};
+    this.promisedBuildId = _promise.default.resolve();
+
+    if (false) {}
 
     if (false) {}
   } // Returns a promise for the dependencies for a particular route
@@ -1418,6 +1424,8 @@ class PageLoader {
     var _this = this;
 
     return (0, _asyncToGenerator2.default)(function* () {
+      if (false) {}
+
       route = _this.normalizeRoute(route);
       let scriptRoute = route === '/' ? '/index.js' : route + ".js";
       const url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
@@ -1485,6 +1493,8 @@ class PageLoader {
     var _this2 = this;
 
     return (0, _asyncToGenerator2.default)(function* () {
+      if (false) {}
+
       route = _this2.normalizeRoute(route);
       let scriptRoute = (route === '/' ? '/index' : route) + ".js";

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 26.7s 27s ⚠️ +267ms
nodeModulesSize 41.2 MB 41.3 MB ⚠️ +45.9 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 17.8 kB 17.9 kB ⚠️ +107 B
main-HASH.js gzip 6.54 kB 6.56 kB ⚠️ +22 B
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
commons.HASH.js 190 kB 190 kB
commons.HASH.js gzip 61.6 kB 61.6 kB
Overall change ⚠️ +107 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.1 kB 16.2 kB ⚠️ +61 B
main-HASH.module.js gzip 6.27 kB 6.28 kB ⚠️ +9 B
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH.module.js gzip 746 B 746 B
commons.HASH.module.js 171 kB 171 kB
commons.HASH.module.js gzip 55.4 kB 55.4 kB
Overall change ⚠️ +61 B
Client Pages
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 905 B 905 B
_error.js 12.1 kB 12.1 kB
_error.js gzip 4.76 kB 4.76 kB
hooks.js 1.06 kB 1.06 kB
hooks.js gzip 600 B 600 B
index.js 343 B 343 B
index.js gzip 237 B 237 B
link.js 8.13 kB 8.13 kB
link.js gzip 3.49 kB 3.49 kB
routerDirect.js 429 B 429 B
routerDirect.js gzip 292 B 292 B
withRouter.js 439 B 439 B
withRouter.js gzip 290 B 290 B
Overall change
Client Pages Modern
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 865 B 865 B
_error.module.js 10.6 kB 10.6 kB
_error.module.js gzip 4.31 kB 4.31 kB
hooks.module.js 596 B 596 B
hooks.module.js gzip 354 B 354 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.67 kB 3.67 kB
routerDirect.module.js 417 B 417 B
routerDirect.module.js gzip 292 B 292 B
withRouter.module.js 427 B 427 B
withRouter.module.js gzip 291 B 291 B
Overall change
Serverless bundles Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_error.js 247 kB 247 kB ⚠️ +730 B
_error.js gzip 66.1 kB 66.3 kB ⚠️ +208 B
hooks.html 2.85 kB 2.87 kB ⚠️ +23 B
hooks.html gzip 852 B 864 B ⚠️ +12 B
index.js 247 kB 248 kB ⚠️ +675 B
index.js gzip 66.4 kB 66.6 kB ⚠️ +241 B
link.js 255 kB 255 kB ⚠️ +675 B
link.js gzip 68.7 kB 68.8 kB ⚠️ +120 B
routerDirect.js 248 kB 248 kB ⚠️ +675 B
routerDirect.js gzip 66.6 kB 66.5 kB -105 B
withRouter.js 248 kB 248 kB ⚠️ +675 B
withRouter.js gzip 66.7 kB 66.6 kB -33 B
Overall change ⚠️ +3.45 kB

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.

Can we add a test to make sure react-dom is not duplicated? 🙏

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.

These changes can't wait on tests. Please address PR review and tests in a follow-up.

@ijjk
Copy link
Member

ijjk commented Aug 22, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 23.9s 23.4s -498ms
nodeModulesSize 41.2 MB 41.2 MB ⚠️ +603 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 18.1 kB 18.1 kB ⚠️ +1 B
main-HASH.js gzip 6.62 kB 6.63 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 increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.5 kB 16.5 kB ⚠️ +1 B
main-HASH.module.js gzip 6.36 kB 6.36 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 decrease ✓
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 908 B 908 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 434 B 433 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 decrease ✓
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 866 B 867 B ⚠️ +1 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 805 B 804 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 430 B 429 B -1 B
withRouter.module.js gzip 293 B 293 B
Overall change -1 B
Client Build Manifests
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex 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
Fetched pages Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
link 3.74 kB 3.75 kB ⚠️ +1 B
link gzip 963 B 964 B ⚠️ +1 B
index 3.69 kB 3.69 kB ⚠️ +1 B
index gzip 955 B 957 B ⚠️ +2 B
withRouter 3.75 kB 3.75 kB ⚠️ +1 B
withRouter gzip 950 B 952 B ⚠️ +2 B
Overall change ⚠️ +3 B

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
buildDuration 25.5s 26.2s ⚠️ +667ms
nodeModulesSize 41.2 MB 41.2 MB ⚠️ +603 B
Client Bundles (main, webpack, commons)
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
main-HASH.js 18.1 kB 18.1 kB
main-HASH.js gzip 6.63 kB 6.63 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 atcastle/next.js fix-granular-chunks-regex Change
main-HASH.module.js 16.5 kB 16.5 kB
main-HASH.module.js gzip 6.36 kB 6.36 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 atcastle/next.js fix-granular-chunks-regex Change
_app.js 1.9 kB 1.9 kB
_app.js gzip 908 B 908 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 atcastle/next.js fix-granular-chunks-regex Change
_app.module.js 1.79 kB 1.79 kB
_app.module.js gzip 867 B 867 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 atcastle/next.js fix-granular-chunks-regex 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
zeit/next.js canary atcastle/next.js fix-granular-chunks-regex Change
_error.js 248 kB 248 kB
_error.js gzip 66.4 kB 66.3 kB -101 B
hooks.html 3.81 kB 3.81 kB
hooks.html gzip 978 B 980 B ⚠️ +2 B
index.js 248 kB 248 kB
index.js gzip 66.6 kB 66.8 kB ⚠️ +120 B
link.js 256 kB 256 kB
link.js gzip 68.9 kB 68.8 kB -151 B
routerDirect.js 249 kB 249 kB
routerDirect.js gzip 66.7 kB 66.7 kB -9 B
withRouter.js 249 kB 249 kB
withRouter.js gzip 66.8 kB 66.8 kB ⚠️ +5 B
Overall change

@Timer Timer merged commit 3896cbe into vercel:canary Aug 22, 2019
const rawRequest =
module.rawRequest &&
module.rawRequest.replace(/^@(\w+)[/\\]/, '$1-')
if (rawRequest) return rawRequest

Choose a reason for hiding this comment

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

            // avoid relative paths
            if (rawRequest && rawRequest[0] !== '.') {
              return rawRequest;
            }

Copy link
Member

Choose a reason for hiding this comment

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

How do you feel about just dropping the names all together?

#8450 (comment)

@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.

4 participants