heroku / heroku/heroku-buildpack-nodejs
Build cache not consistent with globs
- Dominant language
- Shell
- Stars
- 1.3k
- Forks
- 2.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 30
Description
Copied from a support ticket:
Our node app contains the following lines in the package.json:
```
"cacheDirectories": [
"node_modules",
"browser/node_modules",
"node/*/node_modules"
],
```
As you can see, we use a glob to specify which folder need to be cached.
At the end of the build process we see what we expect:
```
Clearing previous node cache
Saving N cacheDirectories (package.json):
- node_modules
- browser/node_modules
- node/foo/node_modules
- node/bar/node_modules
- node/baz/node_modules
```
But when the build starts, and the cached directory are loaded, where is what we see:
```
│remote: -----> Restoring cache
│remote: Loading 3 from cacheDirectories (package.json):
│remote: - node_modules
│remote: - browser/node_modules
│remote: - node/*/node_modules (not cached - skipping)
```
We would expect that the same strategy is applied when restoring the cache (using glob matching in the cached directory).
Contributor guide
Research direction
Start with the cache restore path that reads cacheDirectories from package.json, then compare it with the build-end cache-saving behavior shown in the report. Verify that glob entries such as node/*/node_modules are expanded consistently during restore; done means the cached node/foo, node/bar, and node/baz directories are loaded instead of skipped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, shell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100