Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate package size (consider sideEffect) #124

Open
techniq opened this issue Nov 11, 2023 · 4 comments
Open

Investigate package size (consider sideEffect) #124

techniq opened this issue Nov 11, 2023 · 4 comments
Milestone

Comments

@techniq
Copy link
Owner

techniq commented Nov 11, 2023

It would be useful to make sure our bundle size is as small as possible, and we are leveraging tree shaking as well.

It would be great to track our bundle size over time (with actual usage, not just full NPM size).

We might want to investigate the sideEffect NPM config. I remember this being looked at for d3 and three.js years ago. Also wasn't sure if it's only useful for webpack (and still applicable for rollup/vite)

@techniq techniq added this to the v1 milestone Nov 11, 2023
@techniq
Copy link
Owner Author

techniq commented Nov 13, 2023

Spent a little bit of time trying to look into the install and bundle size of Svelte UX and it's dependencies (with bundle being the most important).

Using pkg-size.dev provides some useful insights:

image

Shows the total install size as 149MB, with 109MB attributable to sveld, although the top graph shows the top dependency as typescript at 67MB.

Using bundlephobia.com show the bundle as 2.5kB minified, and the biggest contributor is self, followed by date-fns and lodash-es (which seems more reasonable for bundle size).

image

Using packagephobia.com, it doesn't provide much insight other than bundle size of 618kb and install size of 143MB

image

When I tried to use bundlejs.com, it didn't provide much useful information, but probably because I don't fully understand how to use it, especially with Svelte.

image

Using npm.anvaka.com it helps to show the dependency tree as a graph, with most of the dependencies comes as the result of @changesets/cli (everything not in the green outline).

image


While there isn't strong evidence from the above, I think the following could be helpful..

  • Remove lodash
  • Consider using unplugin-icons instead of using @mdi/js directly
    • Can we still access the raw path (not just the <svg>...</svg> (although that will still work with <Icon>)?
    • Will this break any change of running the components in the REPL (i.e. without Vite)? Assuming this will still work with SvelteLab, StackBlitz, CodeSandbox, etc with our create-svelte-ux templates as long as they use our vite config.

@techniq
Copy link
Owner Author

techniq commented Nov 13, 2023

Also took a look at a few small projects I've built with Svelte UX, and attemped to ignore the data/API portion

Site DevTools Download Resources
image image 434kB 687 kB
image image 188kB 526 kB
image image 97.2kB 287 kB

They all seemed reasonable.

@techniq
Copy link
Owner Author

techniq commented Nov 13, 2023

Ran a couple quick lighthouse scores (for performance number), and they came back promising as well

image

image

@techniq
Copy link
Owner Author

techniq commented Nov 13, 2023

Consider installing https://github.com/btd/rollup-plugin-visualizer (although based on PRs for Rollup v4, it doesn't look actively maintained at the moment).

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

No branches or pull requests

1 participant