jenkins-bot has submitted this change and it was merged. ( 
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, 12 insertions(+), 8 deletions(-)

Approvals:
  Jhernandez: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/package.json b/package.json
index 8f120d0..22d7429 100644
--- a/package.json
+++ b/package.json
@@ -103,7 +103,7 @@
   "bundlesize": [
     {
       "path": "dist/public/index.*.js",
-      "maxSize": "5.3KB"
+      "maxSize": "5.1KB"
     },
     {
       "path": "dist/public/runtime.*.js",
@@ -115,7 +115,7 @@
     },
     {
       "path": "dist/public/pages/about.*.js",
-      "maxSize": "1.1KB"
+      "maxSize": "1KB"
     },
     {
       "path": "dist/public/pages/home.*.js",
@@ -127,11 +127,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 c2bfcfc..4bafb02 100644
--- a/src/client/webpack.config.ts
+++ b/src/client/webpack.config.ts
@@ -195,10 +195,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: merged
Gerrit-Change-Id: I754d18c4d0b0d968f89f524c5a4d5924e1c6c32d
Gerrit-PatchSet: 3
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to