Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Commit 9aee709

Browse files
committed
Adds a projectRoot option to enable relative cache paths.
Previous to this change cache keys (and the values stored in the cache) were using absolute paths. This meant that moving a buildable repository to a different directory would entirely invalidate the cache, and that the cache wouldn't be shareable between builds in CI when building on different machines. This change adds a new option `projectRoot` that helps to make the paths relative, and therefore reusable when the project changes directories.
1 parent 08554cf commit 9aee709

File tree

5 files changed

+1806
-1779
lines changed

5 files changed

+1806
-1779
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module.exports = {
5252
|**`cacheIdentifier`**|`{String}`|`cache-loader:{version} {process.env.NODE_ENV}`|Provide an invalidation identifier which is used to generate the hashes. You can use it for extra dependencies of loaders (used for default read/write implementation)|
5353
|**`write`**|`{Function(cacheKey, data, callback) -> {void}}`|`undefined`|Allows you to override default write cache data to file (e.g. Redis, memcached)|
5454
|**`read`**|`{Function(cacheKey, callback) -> {void}}`|`undefined`|Allows you to override default read cache data from file|
55+
|**`projectRoot`**|`{String}`|`path.dirname(pkgUp.sync())`|Path used to ensure cache keys/values are relative, and shareable between directories/machines.|
5556

5657
<h2 align="center">Examples</h2>
5758

0 commit comments

Comments
 (0)