Skip to content

Bundle splitting proof of concept - #2091

Closed
david-crespo wants to merge 1 commit into
mainfrom
more-bundle-splitting
Closed

david-crespo wants to merge 1 commit into
mainfrom
more-bundle-splitting

Conversation

@david-crespo

@david-crespo david-crespo commented Mar 22, 2024 •

Copy link
Copy Markdown
Collaborator

@vercel

vercel Bot commented Mar 22, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Apr 26, 2024 9:36pm

Comment thread app/pages/system/lazy.ts
* Copyright Oxide Computer Company
*/

type Page = keyof typeof import('./index.ts')

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't know you can do this, it rules

@david-crespo

Copy link
Copy Markdown
Collaborator Author

We'll figure this out later.

@david-crespo
david-crespo deleted the more-bundle-splitting branch April 13, 2024 02:04
@david-crespo
david-crespo restored the more-bundle-splitting branch April 26, 2024 21:09
@david-crespo david-crespo reopened this Apr 26, 2024
@david-crespo

Copy link
Copy Markdown
Collaborator Author

I pulled out more system pages into the system pages bundle and the results speak for themselves: it's a complete waste of time. Lmao. We're cutting barely more than 1% out of the main bundle.

Before

dist/assets/Terminal-k-txfx7j.js                            287.56 kB │ gzip:  72.15 kB │ map:   590.21 kB
dist/assets/TimeSeriesChart-DNJqSGFX.js                     384.83 kB │ gzip: 107.41 kB │ map: 1,759.67 kB
dist/assets/app-pxHDd_km.js                               1,078.75 kB │ gzip: 337.50 kB │ map: 5,189.44 kB

After

dist/assets/index-C3sI8Wdb.js                                30.82 kB │ gzip:   8.10 kB │ map:   107.52 kB
dist/assets/Terminal-Cz_nk_5N.js                            287.56 kB │ gzip:  72.15 kB │ map:   590.21 kB
dist/assets/TimeSeriesChart-DdtGqp6q.js                     384.83 kB │ gzip: 107.41 kB │ map: 1,759.67 kB
dist/assets/app-BILsoTVx.js                               1,050.90 kB │ gzip: 332.45 kB │ map: 5,086.27 kB

Why so underwhelming

npx vite-bundle-visualizer tells the story: after pulling out xterm and recharts (which we already do) the entire main app.js bundle is taken up by large dependencies that are used in both system and silo pages, like the date picker related stuff. So our best bet is probably to try pulling those things in with dynamic imports so they get their own bundles.

image

@david-crespo
david-crespo deleted the more-bundle-splitting branch April 26, 2024 21:43

This branch was successfully deployed

1 active deployment
Preview — 05d2786f Deployed Apr 26, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More aggressive bundle splitting

1 participant