buskerudbyen / cycling-norway

3 stars 2 forks source link

Widget bundle size #123

Open michaeljohansen opened 4 months ago

michaeljohansen commented 4 months ago

The widget is probably ready to use (as of writing). However, one point of improvement is that the widget bundle size ended up being fairly large at 3MB (1MB gzipped). If the widget ends up being used by several websites it would be a good idea to make it run as lean and fast as possible. The primary way of doing that is to remove parts from the bundle, specifically removing packages that we can do without. Material UI can be removed if we do more UI styling ourselves. React can probably be replaced with Preact which aims to be a smaller version of the same API that is still almost fully compatible.

Remember to take a look at which packages actually take up a lot of space by doing a bundle analysis. E.g. like this: https://create-react-app.dev/docs/analyzing-the-bundle-size/