Skip to content

[Bug]: installing new packages invalidates caches for unrelated targets #2540

@HunterLarco

Description

@HunterLarco

What happened?

I would expect when installing a new package via the npm_translate_lock + npm_link_all_packages that it would not invalidate any cache entries. However, I observe that pnpm add -E foo + aspect lint //... invalidates all targets despite none relying on //:node_modules/foo

Version

Development (host) and target OS/architectures:

Output of bazel --version:aspect 2025.19.5+06d8a1c78

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

bazel_dep(name = "aspect_bazel_lib", version = "2.19.2")
bazel_dep(name = "aspect_rules_rollup", version = "2.0.1")
bazel_dep(name = "aspect_rules_lint", version = "1.5.3")
bazel_dep(name = "rules_nodejs", version = "6.4.0")
bazel_dep(name = "aspect_rules_js", version = "2.4.0")
bazel_dep(name = "aspect_rules_ts", version = "3.6.3")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "platforms", version = "1.0.0")

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(pnpm_version = "9.15.9")
use_repo(pnpm, "pnpm")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
    name = "npm",
    npmrc = "//:.npmrc",
    pnpm_lock = "//:pnpm-lock.yaml",
)
use_repo(npm, "npm")

Language(s) and/or frameworks involved: typescript, javascript

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions