2

I was reviewing an Angular (remember this) project where I work to find any possibilities to optimize the performance of app. For a moment an idea came to me to look and analyze package.json and see if there is any package listed there but it's not being used in the application.

...aaaandd there were fucking 32 unused packages. 32 packages that have been installed but are not used anywhere in the application. 32!!!!!

And you know what the best part is. 2 of them were react packages. I mean, literally, their name was react-bllabllablla- component, and when I visited npmjs website, their description was react component that does bllabllablla. It's fucking react....... It's in the name, it's in the description. Is my company giving jobs to fucking blind developers or what? I'm going crazy!

Comments
  • 0
    Hahaha hilarious πŸ˜‚πŸ˜‚
  • 3
    Packages in package.json are only included in the final bundle if you actually import them in the code. If they are not imported, there's no way they will magically appear in the bundle. Basically, you just removed 32 entries, but not actually made it faster. Also, if you import something but never actually read the value returned by the import, webpack is smart enough not to include it in the final bundle. Use webpack-bundle-analyzer to tackle what is actually taking up space in the final build. Performance problems in angular apps can be easily solved by just start lazy-loading certain groups of routes.
  • 0
    You gots the package cancer 😜

    That said, Angular is insanely flexible. So flexible that it can actually consume and use react as it's rendering engine. And there's a certain contingent of masochists who are into that.

    Thank you for doing cthulhu's work and cutting the rot out at the source πŸ‘
  • 0
    @bartmr Yes, of course, you are absolutely right about final bundle size and lazy loading. One thing is that, beside many other problems, our company deploys multiple times per day and the pipeline that builds application is taking too much time. That's why I looked at what packages we were using to see if we can remove some libraries without braking functionalities. And that's when I got "amazed".
  • 1
    If you wanna be happy for the rest of your life, ne-ver abuse a pa-ckage during your life! 🎢
Add Comment