sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.28k forks source link

Review `app.bundle.js` for code-splitting optimizations #26433

Closed umpox closed 2 years ago

umpox commented 3 years ago

Similar to https://github.com/sourcegraph/sourcegraph/issues/26348 but higher priority as it is the bundle that we load on every page.

More context: https://sourcegraph.slack.com/archives/C014ZCKMCAV/p1634827138005800

image

When disabling Webpack concatenateModules

image

github-actions[bot] commented 3 years ago

Heads up @umpox @valerybugakov @5h1ru @pdubroy @taylorsperry - the "team/frontend-platform" label was applied to this issue.

umpox commented 2 years ago

Potential savings (size measured in gzip):

Dependencies that should potentially be lazy-loaded

Potential savings: 129kb

Other code that should potentially be lazy-loaded

There's quite a bit here, in my view anything that isn't part of the nav bar or 'core UI' should be lazy-loaded. Few notable files: ~main.worker.ts: 86kb.~ -> Fixed by https://github.com/sourcegraph/sourcegraph/pull/26610 Folder: src/enterprise/insights: 17kb Folder: src/site-admin: 5kb

Potential savings: 108kb

Notes:

Final savings

Potential savings: 237kb -> ~33% decrease in app.bundle.js bundle size