fix(@angular-devkit/build-angular): ensure NG_PERSISTENT_BUILD_CACHE always creates a cache in the specified cache directory#21274
Conversation
…` always creates a cache in the specified cache directory This change fixes `NG_PERSISTENT_BUILD_CACHE` sometimes creating cache entries that live outside of the cache directory by using a hex encoding rather than a base64 encoding. This error is caused because the base64 alphabet includes `/`. According to the webpack documentation [1] the default `cacheLocation` is: path.resolve(cache.cacheDirectory, cache.name) Which means cache names with a leading `/` would remove the `cacheDirectory` altogether. [1]: https://webpack.js.org/configuration/other-options/#cachecachelocation
|
@alan-agius4 I'm not sure if base64 is preferred and a prefix should just be added to the cache name. Kicking off the CI to see what tests are on it. |
alan-agius4
left a comment
There was a problem hiding this comment.
LGTM, although we could also be encodeURIComponent
|
True, but it sounds like there's not a strong reason to use base64 and it looks like it doesn't break any tests so it probably makes sense to just leave it as hex encoding. Node 16 looks like it has base64url, but I'm not sure it's worth picking the encoding based on the node version. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This change fixes
NG_PERSISTENT_BUILD_CACHEsometimes creating cache entries that live outside of the cache directory by using a hex encoding rather than a base64 encoding. This error is caused because the base64 alphabet includes/. According to the webpack documentation 1 the defaultcacheLocationis:path.resolve(cache.cacheDirectory, cache.name)which means cache names with a leading/would remove thecacheDirectoryaltogether.