How Yarn Actually Works

Описание к видео How Yarn Actually Works

If you use Yarn, you have probably run 'yarn install' many times, and you might have wondered, what is happening during the install? How does Yarn actually work?

Sure, you might think that Yarn looks at package.json, fetches the dependencies from a remote registry, like npm, and creates the node_modules (or .pnp.cjs if you enabled Yarn PnP). On a very high level that's correct, however, it's a bit more complicated than that.

For example, a good question we might ask is: what role does the yarn.lock and the yarn cache play during installation?

So, in this video, we will see what Yarn actually does to install your dependencies.

In short, a 'yarn install' consists of 3 steps: Resolution, Fetch, and Link. We will see each of these steps in more detail and I will explain when these steps are fast and when they are slow, so you have an understanding of why running an install is at times slower than you would expect.

Note that in this video I talk about how Yarn Berry works (i.e., modern versions of Yarn like Yarn 2 and Yarn 3). However, this still somewhat applies to Yarn 1, which basically goes through very similar steps.

00:00 Introduction
00:33 Resolution step
03:02 Fetch step
04:44 Link step
06:33 Conclusion

Комментарии

Информация по комментариям в разработке