Category Archives: Frontend

From NPM to Yarn

Recently Facebook introduced a new package management for nodejs called Yarn. I was hesitate to try out from the beginning but now i am completely switch to Yarn for nodejs package management. You can learn everything about Yarn on the website, but here are my biggest benefits from switching to Yarn

  • Faster: It is really faster. Yarn package resolution is fast, and it caches package locally, so next time you run yarn again it will use cache from your local disk. The packages are also download in parallel too. In my case, I see a 2x speed up!
  • Frozen dependencies by default: For npm, you need to run shrinkwrap everytime you add a new package. But for yarn, it’s default. This means no dependencies mis-match between me and my teammate anymore. Plus, the yarn.lock file is easier to diff when there is a conflict.
  • Nicer output: Yarn console output is much cleaner 😀

There are also other benefits, but only these 3 are enough for me to drop npm!