Does cleaning the user yarn cache will affect docker image? Does cleaning the user yarn cache will affect docker image? docker docker

Does cleaning the user yarn cache will affect docker image?


yarn Version 1

You can safely remove cache files, it will not affect your application. There's even a dedicated command for that:

$ yarn cache clean

yarn Version 2

With Plug'n'Play, however, clearing the cache will very likely break your application because dependencies are no longer placed in node_modules. Here's what the documentation says:

In this install mode (now the default starting from Yarn v2), Yarn generates a single .pnp.js file instead of the usual node_modules. Instead of containing the source code of the installed packages, the .pnp.js file contains a map linking a package name and version to a location on the disk, and another map linking a package name and version to its set of dependencies. Thanks to this efficient system, Yarn can tell Node exactly where to look for files being required - regardless of who asks for them!

The location on the disk is cache.

You can get the old behavior back by placing this in your .yarnrc.yml file.

nodeLinker: node-modules

Read more about Plug'n'Play here