The @nx/powerpack-shared-fs-cache
plugin enables you to use an shared file system directory instead of Nx Cloud to host your remote cache. You are responsible for the sharing mechanism for the directory, but the plugin ensures that Nx correctly associates task metadata with the file artifacts.
Using a shared file system folder for the remote cache opens you up to the possibility of cache poisoning. To avoid this, use Nx Replay or share your cache with an AWS S3 bucket using @nx/powerpack-s3-cache
.
In order to use @nx/powerpack-shared-fs-cache
, you need to have an active Powerpack license. If you don't have a license or it has expired, your cache will no longer be shared and each machine will use its local cache.
Setup
1. Install the Package
- Activate Powerpack if you haven't already
- Install the package
❯
nx add @nx/powerpack-shared-fs-cache
2. Configure the Cache Directory
The @nx/powerpack-shared-fs-cache
plugin treats your local cache directory as if it is also a remote cache directory. The local cache directory can be set using cacheDirectory
in the nx.json
file or the NX_CACHE_DIRECTORY
environment variable. The default local cache directory is .nx/cache
3. Share the Cache Directory
The @nx/powerpack-shared-fs-cache
plugin does not actually share the cache directory across your organization. If you want that functionality, use Nx Replay instead. Your shared file system directory might be a directory that is saved and restored by a CI provider or it could be a shared network drive.