As a developer, I have limited time (and incentive). I could implement something in say a 100 lines of code with 4 hours of effort or just import a 1MB library from which I might call one or two functions. This will end up increasing the size of the package that gets delivered to the end user, though there are some optimizations during the packaging process.
In some scripting languages like Ruby or Python, you install the libraries at the system level. This combined with a good package manager (e.g. apt on Debian) will keep the size of your software small, since it can share the libraries with others.
But not much difference in terms of size at runtime.
It's mostly a developer incentive issue more than framework or OS.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!