radio4000 / components

web-components to build the r4 interfaces, uses the sdk
https://components.radio4000.com/
1 stars 0 forks source link

Optimize bundle size #179

Open oskarrough opened 1 month ago

oskarrough commented 1 month ago

Our JavaScript for the components is 1.5mb. Considering we don't even have a framework™️ it's a lot.

dist/index-Dv1Vd9fA.js             1,499.01 kB │ gzip: 357.64 kB

However most of it is the dependency on ol (for the map) as far as I know.

The site is definitely not slow even with the big bundle. It's cached. But we could still try to 1) reduce the size 2) split the big dependencies into other bundles? Like only load ol once the r4-map component is connected. But don't know how that would work.

oskarrough commented 1 month ago

Tried using the manualChunks feature of Rollup to split up the big ones. Not sure what effect it would have on performance in the end, or when the chunks are loaded.

dist/supabase-BzIw9nIb.js          180.56 kB │ gzip:  41.93 kB
dist/r4playerv1-BZf4AAU1.js        263.37 kB │ gzip:  67.23 kB
dist/ol-af2OZp3O.js                514.88 kB │ gzip: 114.13 kB
dist/r4.js                         539.59 kB │ gzip: 136.02 kB