Hacker News new | ask | show | jobs
by afavour 1099 days ago
> The number of dependencies in Svelte has been greatly reduced from 61 down to 16

Adore this. Would love to see more JS frameworks reduce their dependency trees.

2 comments

I understand this thought for external dependencies, but dependencies also includes internal ones, which I don't see a reason to reduce. Modularity and re-usability of individual pieces of code are a good sign for me.
I assume they mean external dependencies when they say that. I'm not sure what the point of the statement would be if it included internal ones.
Dependency managers like NPM don't differentiate between internal and external dependencies. I assumed that the Svelte devs were referring to this. Vue for example only has internal dependencies, but NPM shows them as any other: https://www.npmjs.com/package/vue?activeTab=dependencies
It's referring to all transitive dependencies - not just direct dependencies. More like this: https://npm.anvaka.com/#/view/2d/vue
Good point, didn't want to make it seem different! Just wanted to show that internal dependencies are also tracked as any other dependency.
Should just bundle the npm module to a single file with esbuild before publishing it.
There are tradeoffs there. E.g. many of Svelte's dependencies are shared by bundlers such as Vite, Rollup, and their plugins. If you bundle those dependencies it means they have to be downloaded multiple times. It also means you can't use the cache from efficient package managers like pnpm. And lastly, it makes it harder to deal with security issues. If there's a security issue in a dependency then Svelte would need to ascertain whether it could affect users, upgrade the dependency, and file a CVE against Svelte itself. Users would then have to upgrade Svelte in addition to the dependency if it's shared by any other libraries.