you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 1 year ago (5 children)

I didn't know about treeshaking (still unsure what it is exactly since I'm not a js Dev), but I'm guessing it still takes up Gigs of space in the project folder of every Devs PC, duplicated for each project.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 6 points 1 year ago (2 children)

    It does take a lot of space for devs, but personally I find that absolutely irrelevant, because it's your end user's experience that really matters, and - as a dev - you are most likely to have a much better rig and internet connection than your average Joe.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 1 year ago* (1 child)

    Sure, in many cases the dev's computer is powerful enough to handle that.

    However:

    • The more the dependencies, the more likely it is to pull-off a supply chain attack. Any of those thousands modules can be compromised and infect either the user or the developer.
    • Not all computers are optimized for working with so many tiny files. Have you ever worked in a company that uses McAfee Antivirus? Even Defender can be a massive performance hit in some cases.
  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 year ago

    I have to say that I may be a bit ignorant, because I'm mostly engaged in greenfield projects with very tiny devteams and I always keep my dependencies count low as possible

    Thank you for pointing this out, that's very valuable to keep in mind

  • source
  • parent
  • [–] 3 points 1 year ago

    Tree shaking is essentially reducing the amount of included code to only the stuff being used.

    Let’s say you have a JAR, DLL, or whatever with 5 functions.

    Your application calls function A which also calls function B of the DLL/jar.

    Tree shaking says “hmm, if I follow the code execution path, I only need 2/5 functions from the DLL/jar” and discards the remaining 3/5 functions.

    This significantly reduces the bundle size (the bundle is what is sent to the browser).

  • source
  • parent
  • [–] 3 points 1 year ago

    Some use 'pnpm' package manager, alternative to default, where the packages are downloaded once to a central location, and per project directory, it links to the original location so files aren't duplicated saving space

  • source
  • parent