Hello, my name is Zoltan Kochan and today I'm going to talk about pnpm, which is a fast disk space efficient package manager.
Before that let me introduce myself. I'm Zoltan Kochan. I was born and raised in Ukraine. I currently live in Ukraine as well. For now I'm safe. I work remotely for BIT. BIT is a company that helps developers to implement component-based development. Before BIT I worked for Just Answer for nine years and in the meanwhile, since 2016, I'm constantly developing and maintaining npm-pm.
Before talking about npm-pm let's briefly talk about other Javascript package managers. The most popular node.js or javascript package manager is npm which is the official package manager of the npm registry. It is shipped by node.js and in the past npm had a lot of issues, like it was slow, it was undeterministic, it was giving funny results sometimes, so some alternatives were created. One of the alternatives was created by facebook, you probably heard about yarn, which is the second most popular package manager after npm. It is now maintained by the community, and it did solve a lot of the issues that npm had in version 3 and 4. Since then, in v2, yarn has switched to use plug and play by default, so even though it does support classic node modules installation, now it prefers to use the plug and play, which many love and many hate. I personally think it's a cool feature. And yarn is currently shipped with the latest version of Node.js. The 3rd most popular package manager is pnpm. It is a completely indie project, it was created by open source contributors to fix the issues of npm v3. At the same time as yarn 2, so pnpm is not like a new project, it exists since yarn exists, basically. And now it is supported by bit, because I work at bit and pnpm is heavily used in the bitcli for package management and pnpm as well is shipped with nodjs through the corepack feature of nodjs. If we compare these package managers by popularity, obviously npm is currently the most popular one, then yarn and pnpm is the less popular, even though pnpm came out at the same time as yarn, but of course facebook had a lot of marketing power to make yarn very popular at the start. However, even though pnpm is less popular for now, it had a big spike in popularity last year, so in 2021 pnpm was downloaded three times more than in 2020. We have a lot of big tech companies that already use pnpm, so even Microsoft uses pnpm in some of its projects, and the TikTok frontend team uses pnpm. So pnpm works really well, and is production ready for sure.
Let's see what makes pnpm unique. When you install a dependency with npm or Yarn Classic, all the sub-dependencies are hoisted to the root of node modules. As you may see in this example, even though only Express is in the dependencies, all those other packages are also hoisted to the root of node modules. On the contrary, pnpm is only put in Express to the root of node modules. So even though cookie is not a dependency of your project, importing it will work. This is a dangerous situation.
Comments