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

Change subject: Perf: Improve code sharing between pages
......................................................................

Perf: Improve code sharing between pages

Configure webpack so that chunks used among more than 3 parent chunks
will be lifted to the common parent.

This makes that all common elements, like the header, wordmark, icons,
page template, card, are automatically lifted into the common chunk,
being index.js in this case.

Comparison (non-gzip sizes):

* Before (total 160K):
   20K    dist/public/index.3e543ae18c094807c955.js
   20K    dist/public/pages/about.23721da3b55605601ee0.js
   20K    dist/public/pages/home.99363b43562866532591.js
   16K    dist/public/pages/not-found.104c8077664cd063ac86.js
   24K    dist/public/pages/style-guide.caa9db735298fb9d7dee.js
   24K    dist/public/pages/wiki.09b88f04fdbe22295f04.js
   4.0K    dist/public/runtime.9097ad5d9ba98ecb9096.js
   32K    dist/public/vendor.07d6d6a8fd5f0f1d2bec.js

* After (total 92K):
   32K    dist/public/index.df069cf889895de80a7f.js
   4.0K    dist/public/pages/about.6fc719150776bb977579.js
   4.0K    dist/public/pages/home.5c2590e60dbfd2d1877c.js
   4.0K    dist/public/pages/not-found.2c71549e2d8994df6930.js
   4.0K    dist/public/pages/style-guide.b8649afb0b94be268684.js
   8.0K    dist/public/pages/wiki.97bf4a2915b6493bf060.js
   4.0K    dist/public/runtime.7725163c2492f61e55a4.js
   32K    dist/public/vendor.fb8d0e270bc072258848.js

Change-Id: I1c246fcf82aa6a38478e8ffe333d8ee9dfccef4f
---
M webpack.config.ts
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/08/379808/1

diff --git a/webpack.config.ts b/webpack.config.ts
index 14734f7..b5e0d22 100644
--- a/webpack.config.ts
+++ b/webpack.config.ts
@@ -226,6 +226,15 @@
     minChunks: Infinity
   }),
 
+  // When using code splitting, move common chunks of child chunks into the
+  // parent chunks, when used a minimum number of times. 3 times used is
+  // considered right now like a good tradeoff.
+  // 
https://webpack.js.org/plugins/commons-chunk-plugin/#move-common-modules-into-the-parent-chunk
+  new webpack.optimize.CommonsChunkPlugin({
+    children: true,
+    minChunks: 3
+  }),
+
   // Create a separate chunk for the client's Webpack runtime. When a name with
   // no corresponding entry is specified, Webpack injects all the code needed
   // during execution for module resolution, dynamic importing, and more.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c246fcf82aa6a38478e8ffe333d8ee9dfccef4f
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>

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

Reply via email to