Skip to content

Bundle dashboard assets#20

Open
redstonekasi wants to merge 1 commit into
mainfrom
dev/kasimir/dashboard
Open

Bundle dashboard assets#20
redstonekasi wants to merge 1 commit into
mainfrom
dev/kasimir/dashboard

Conversation

@redstonekasi
Copy link
Copy Markdown
Member

Dashboard assets are bundled during startup using esbuild and served from cache.
This approach does not introduce an additional build step, keeping the installation process the same as usual.

Bundling and serving all our own dependencies has two main benefits:

  • Everything can be downloaded over one connection.
  • Previously, the dashboard needed over 600 requests to load, due to the nature of the date-fns package and esm.sh's behaviour. This is no longer the case.

Prior caching behaviour is maintained by moving the dynamic state into an inline script in the main HTML file. Scripts and fonts are cached for a long time.

I'm not dead set on getting this merged, but I think it does improve things overall.

@redstonekasi redstonekasi force-pushed the dev/kasimir/dashboard branch from 6a5c396 to 8ce8be4 Compare May 23, 2026 16:14
@yellowsink
Copy link
Copy Markdown
Member

Previously, the dashboard needed over 600 requests to load, due to the nature of the date-fns package and esm.sh's behaviour. This is no longer the case.

can you not combine ?exports with ?bundle? these options would make esm.sh bundle all files and tree shake that server side.

@yellowsink
Copy link
Copy Markdown
Member

I did this for plot so I'm surprised I didn't for date fns

@yellowsink
Copy link
Copy Markdown
Member

oh shit I did did I just forget the ?bundle

@redstonekasi
Copy link
Copy Markdown
Member Author

can you not combine ?exports with ?bundle? these options would make esm.sh bundle all files and tree shake that server side.

Nope, that doesn't work. They've since shuffled flags around a bit, but regardless, they don't support bundling things in cases like date-fns where every function receives its own export. Doing so could subtly break things is their reasoning, they're not wrong, but in this case that isn't the case of course.

@yellowsink
Copy link
Copy Markdown
Member

:( ok fair

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.

2 participants