pnpm - Fast, disk space efficient package manager

pnpm - Fast, disk space efficient package manager

Official website address

https://www.pnpm.cn/

Features

When using npm, if you have 100 projects and all of them have the same dependency, then you need to keep 100 copies of the same dependency on disk. However, if you use pnpm, the dependent packages will be stored in a unified location, so:

  1. If you need to use different versions of the same dependency, only the files that differ between versions will be stored. For example, if a dependency package contains 100 files, a new version is released, and only one file is modified in the new version, pnpm updateonly new file needs to be added to the storage, and it will not be saved because of one file modification All files of the dependent package.
  2. All files are saved in a unified location on the hard disk. When a package is installed, all the files it contains are hard-linked from this location without taking up additional hard disk space. This allows you to easily share the same versions of dependencies between projects.

The end result is that you save a lot of hard disk space in terms of the ratio of projects and dependencies, and the installation speed is also greatly improved!

npm install pnpm

npm install -g pnpm

Use pnpm to install dependencies

pnpm install

8558467.jpg

Screenshots during the installation process, the installation speed is very fast

The directory structure is as follows

8558467.jpg

Then delete the node_module package, install it with npm, and check the directory structure

8558467.jpg

The dependency structure downloaded using pnpm can be clearly compared

Start the project with pnpm

pnpm dev

middle run omitted

View more commands:

https://www.pnpm.cn/cli/add

Guess you like

Origin blog.csdn.net/SongZhengxing_/article/details/129040244
Recommended