Niedzielski has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391881 )

Change subject: Chore: improve chunk size
......................................................................

Chore: improve chunk size

Use path hashes for referencing chunks instead of the paths themselves.
This change is only for production builds and gives a modest performance
improvement as checked by the updated bundlesizes.

Bug: T179826
Change-Id: I754d18c4d0b0d968f89f524c5a4d5924e1c6c32d
---
M package.json
M src/client/webpack.config.ts
2 files changed, 13 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/81/391881/1

diff --git a/package.json b/package.json
index 88b02d3..292fb76 100644
--- a/package.json
+++ b/package.json
@@ -101,11 +101,11 @@
   "bundlesize": [
     {
       "path": "dist/public/index.*.js",
-      "maxSize": "5.3KB"
+      "maxSize": "5.1KB"
     },
     {
       "path": "dist/public/runtime.*.js",
-      "maxSize": "1.1KB"
+      "maxSize": "1KB"
     },
     {
       "path": "dist/public/vendor.*.js",
@@ -113,7 +113,7 @@
     },
     {
       "path": "dist/public/pages/about.*.js",
-      "maxSize": "1.1KB"
+      "maxSize": "1KB"
     },
     {
       "path": "dist/public/pages/home.*.js",
@@ -125,11 +125,11 @@
     },
     {
       "path": "dist/public/pages/summary.*.js",
-      "maxSize": "3.1KB"
+      "maxSize": "2.9KB"
     },
     {
       "path": "dist/public/pages/wiki.*.js",
-      "maxSize": "3.5KB"
+      "maxSize": "3.3KB"
     }
   ]
 }
diff --git a/src/client/webpack.config.ts b/src/client/webpack.config.ts
index 49117a7..45622c4 100644
--- a/src/client/webpack.config.ts
+++ b/src/client/webpack.config.ts
@@ -200,10 +200,14 @@
 
   definePlugin,
 
-  // Reference modules by name instead of by chunk ID so hashes don't change
-  // when new files are added. For example,
-  // `"./node_modules/preact/dist/preact.esm.js"` instead of `18`.
-  new webpack.NamedModulesPlugin(),
+  // Reference modules by path hashes (i.e., a hash based on the filename) in
+  // production and path names in development instead of by chunk ID so chunk
+  // hashes don't change when new files are added. For example, `"+OPC"`
+  // (production) / `"./node_modules/preact/dist/preact.esm.js"` (development)
+  // instead of `18`.
+  PRODUCTION
+    ? new webpack.HashedModuleIdsPlugin()
+    : new webpack.NamedModulesPlugin(),
 
   new ExtractTextPlugin({
     // `contenthash` is not actually a chunk hash:

-- 
To view, visit https://gerrit.wikimedia.org/r/391881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I754d18c4d0b0d968f89f524c5a4d5924e1c6c32d
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to