After you configure your offline mirror, Yarn will automatically add new package tarballs to the mirror. However, it does not automatically remove tarballs that are no longer referenced in
yarn.lock. For example, if you
$ yarn remove a dependency, the tarball will remain in the mirror, even if no other dependencies have it as a sub-dependency. This behavior can be desirable in a setting where many projects share the same mirror, but when that is not the case, you may want to have Yarn remove unnecessary tarballs.
To turn on automating pruning, set
true in your
$ yarn config set yarn-offline-mirror-pruning true
Now, tarballs will be removed when appropriate. The end result is that
yarn.lock, and the offline mirror should all remain perfectly in sync whenever you change your project’s dependencies.
© 2016–present Yarn Contributors
Licensed under the BSD License.