✍️
Today IL
  • Today I learned!
  • Deployment
    • Rolling, Canary, Blue-green deployments
    • Kubernetees Helm Charts
  • AI/ML
    • SeldonIO
    • Installing software in E2E cloud compute
    • Watching nvidia-smi
    • How does github copilot works?
    • composer library
    • Better to pass callback in fit_one_cycle
    • Eliza - demo
    • Helsinki-NLP Translation models
  • Fastai Learning
  • Python
    • Understanding get_image_files in fastai
    • Resizing an image to smaller size
    • Extracting a Json Object as List(regex)
    • f-strings debugging shortcut
    • Pytest
    • conda switch between python versions
    • Nested functions exception handling
  • Programming
    • Installing Linux Operating system
    • Certbots usage
    • Code highlighting in Google Docs
    • HTTP Methods
    • How to use vertical mouse?
    • HTTP Status Codes
    • Keycloak, Oauth, OpenID connect, SAML
    • Why should NPM packages be as small as possible?
    • Clean Architecture
    • REST vs gRPC
    • Keycloak concepts
    • what is proxy server and nginx?
    • Asymptotic Time Complexity
  • async/await
    • JavaScript Asynchronous operation
    • Lesson 2- Eventloops
    • Lesson 1- asyncio history
    • Lesson 3- using coroutines
    • Lesson 4- coroutines in hood
    • Python async/await
    • JavaScript
  • R Programming language
    • Facet_grid and Facet_wrap
    • geom_point
  • C programming language
    • Inputting String in C programming language
    • Checking if a element is passed as input or not?
  • Git/Github
    • give credits to other people
    • one time setting to easily use Github
    • Checkout to specific tag
    • git suggestions in PR
    • Using emojis in git commits
  • Databases
    • Postgres Database Dockercompose
    • TIL New SQL Operators - Except, UNION, Distinct
    • Analysing Performance of DB Queries
    • Querying Date ranges in postgres
    • Handling Database disconnects in SQLAlchemy
  • WITH NO EXCEPT
  • What is difference with JSON documents in postgres and Mongodb
Powered by GitBook
On this page

Was this helpful?

  1. Programming

Why should NPM packages be as small as possible?

PreviousKeycloak, Oauth, OpenID connect, SAMLNextClean Architecture

Was this helpful?

Most of the popular NPM packages are very small in size, as it's a crucial thing that affects the npm packages. Let's look at why it's a crucial thing:

One is the performance factor of the applications you are building. Most of the applications you are working on are to be highly performant, and should work even in low bandwidth settings.

Imagine if your npm package let's say is 10 MB in size. I don't expect 99% of users in India never load your application in web or mobile build with node_modules. But Why?

It's because loading your application will easily take 5-10 seconds, while an average application is expected to return a meaningful content load usually in milliseconds. This is why it's very important to keep your application small in size, and easily usable for a lot of folks. This is why popular NPM packages like React, moment.js are just Kbs in size.

One of the most common complaints, I heard from other folks was why to use React for a TodoList App with 3MB size when you can do the same thing easily with vanilla JS + CSS(which is in a few KBs) for a very performant reason. Any frontend framework has its pros and cons.

Also, it's very important to make your packages as small as possible to be highly reliable and cost less cost for computing required for hosting. So one of the simplest things we can do is to reduce dependencies as much as possible.

This can be done by not trying to install third-party dependencies when we are working on any application. Even though I agree a lot of stack-overflow answers recommends this approach. Yet generally the loading time is not so slow even though there are dependencies, as most of the common dependencies like JQuery which are commonly used in multiple websites are cached in the users' browser itself if they come from CDN.

Adam Polak recommends how to reduce .

I would like to thank for sharing this knowledge.

size of node modules for Cost and performance reasons
Faiz Shabeeb