Speeding up the npm install

前端 未结 8 1886
忘掉有多难
忘掉有多难 2021-02-01 14:54

I am trying to speed up the npm install during the build process phase. My package.json has the list of packages pretty much with locked revisions in it. I\'ve also configured t

8条回答
  •  迷失自我
    2021-02-01 15:32

    It's better to install pnpm package using the following command:

    npm i -g pnpm

    pnpm uses hard links and symlinks to save one version of a module only ever once on a disk. When using npm or Yarn for example, if you have 100 projects using the same version of lodash, you will have 100 copies of lodash on disk. With pnpm, lodash will be saved in a single place on the disk and a hard link will put it into the node_modules where it should be installed.

    As an example I can mention that whenever you want to install the dependencies of package.json file, what you should do is simply that enter the pnpm i and it handles the other things by itself.

提交回复
热议问题