GenSpectrum / dashboard-components

https://genspectrum.github.io/dashboard-components/
GNU Affero General Public License v3.0
2 stars 0 forks source link

ci(components): provide a standalone JS bundle #400

Closed chaoran-chen closed 4 months ago

chaoran-chen commented 4 months ago

resolves #399

Summary

This PR changes the vite release config to create a bundle that includes all dependencies.

@fengelniederhammer, @JonasKellerer, do you see some disadvantages of doing that?

vercel[bot] commented 4 months ago

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

Name Status Preview Comments Updated (UTC)
dashboard-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 8:58pm
github-actions[bot] commented 4 months ago

There is no change in the changelog.

chaoran-chen commented 4 months ago

I'll merge this without reviews as it is otherwise blocking me. Please share if you have concerns about this change!

fengelniederhammer commented 4 months ago

Did you check what the result of the built output is?

Does the bundled output contain all dependencies? Are some maybe still missing?

A potential disadvantage that I can think of is that the dependencies of this library are bundled into the output so that consuming code can't reuse them (if they use the same libraries).

chaoran-chen commented 4 months ago

It seems to contain everything, this codepen works: https://codepen.io/chaoran-chen/pen/KKjNdwj?editors=1000

fengelniederhammer commented 4 months ago

This increased the library size by a factor of 4:

Before:

[vite:dts] Start generate declaration files...
dist/style.css                106.30 kB │ gzip: 18.97 kB
dist/dashboard-components.js  325.63 kB │ gzip: 64.53 kB │ map: 536.13 kB

After:

[vite:dts] Start generate declaration files...
dist/style.css                  106.30 kB │ gzip:  18.97 kB
dist/dashboard-components.js  1,289.58 kB │ gzip: 274.41 kB │ map: 2,439.80 kB
chaoran-chen commented 4 months ago

We could, in the future, build two bundles, one with and one without external dependencies.