Page MenuHomePhabricator

dist/ size (both init and app module)
Closed, ResolvedPublic

Description

As a user I want to use bridge on my underpowered devices so that I can contribute to free knowledge.

Currently only the init build is happening with the target "application", while the app build is happening with the target "commonjs" (i.e. it is built as a library in order for ResourceLoader to be able to consume it, and the developers to be able to dispatch it at will). This results in less optimizations to be applied to it (app) than possible.

AC

  • ResourceLoader can still load app and we can still dispatch it as module (i.e. not a script)
  • bundle size is decreased "as far as possible"
    • e.g. we continue to use libraries which add some weight to the payload, but only the part of it which we actually make use of are shipped to the clients

Notes

  • it was suggested to "remove underused libraries", but we feel this is a last resort and instead we should actually try and achieve that we only ship the relevant parts but still leverage awesome 3rd party OSS

Event Timeline

  1. re-evaluate if building for commonjs is "the right thing" or if there is not some other way to build app which gets vue's default build optimization but still has the features we need (export launch & createServices, ...)
  2. look for deps (e.g. polyfills) which are shared by the bundles (init and app) and move them to a third, shared bundle (chunk is a keyword which keeps coming up)
    • there seems to be a MediaWiki core ResourceLoader module which ships important polyfills, maybe use this (T248840)
  3. http-status-codes was a poor example b/c it is unused at the moment, but look for a new example which can be used to validate if tree shaking is happening for app. We can try and dump the configuration (which is the result of using the vue configuration as a layer of abstraction) to see if we can influence the tree shaking configuration from there

Step 1: 're-evaluate if building for commonjs is "the right thing"'

Step 2: 'tree shaking'

Change 598443 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[mediawiki/extensions/Wikibase@master] bridge: DNM: split out code shared between init and app

https://gerrit.wikimedia.org/r/598443

Change 598460 had a related patch set uploaded (by Tonina Zhelyazkova; owner: Tonina Zhelyazkova):
[mediawiki/extensions/Wikibase@master] Add --report flag on build

https://gerrit.wikimedia.org/r/598460

Change 598725 had a related patch set uploaded (by Tonina Zhelyazkova; owner: Tonina Zhelyazkova):
[mediawiki/extensions/Wikibase@master] bridge: Share modules between chunks using dependOn

https://gerrit.wikimedia.org/r/598725

Change 598733 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: split out code shared between init and app

https://gerrit.wikimedia.org/r/598733

Change 598460 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add --report flag on build

https://gerrit.wikimedia.org/r/598460

Change 599047 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: fix img paths in CSS

https://gerrit.wikimedia.org/r/599047

Change 599047 abandoned by Lucas Werkmeister (WMDE):
bridge: fix img paths in CSS

Reason:
squashed into parent change (we did not find a better solution; issue might be due to https://github.com/vuejs/vue-cli/issues/4896)

https://gerrit.wikimedia.org/r/599047

Change 598733 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: split out code shared between init and app

https://gerrit.wikimedia.org/r/598733

Change 599704 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: don't build dev entrypoint code as library

https://gerrit.wikimedia.org/r/599704

I think this can be closed now, we’ve made a lot of improvements here.

Change 599704 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: don't build dev entrypoint code as library

https://gerrit.wikimedia.org/r/599704

Change 598725 abandoned by Tonina Zhelyazkova:
bridge: Share modules between chunks using dependOn

Reason:
there were other solutions that actually work and were merged :D

https://gerrit.wikimedia.org/r/598725

Change 598443 abandoned by Lucas Werkmeister (WMDE):
bridge: DNM: split out code shared between init and app

Reason:
T253202 was resolved in the meantime

https://gerrit.wikimedia.org/r/598443

Change 602112 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] bridge: remove unused data-bridge.common.js from dist/

https://gerrit.wikimedia.org/r/602112

Change 602112 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: remove unused data-bridge.common.js from dist/

https://gerrit.wikimedia.org/r/602112