You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(misc): declare lazy-loaded @nx/* packages as optional peers for storybook, web, vitest, and vue (#35393)
## Current Behavior
Several `ensurePackage('@nx/X', nxVersion)` and `ensurePackage<typeof
import('@nx/X')>(...)` references are invisible to Nx's project-graph
source analysis, so the corresponding workspace edges are missing today:
-
`packages/storybook/src/generators/configuration/lib/util-functions.ts`
lazy-loads `@nx/web`
- `packages/web/src/generators/application/application.ts` lazy-loads
`@nx/cypress`, `@nx/eslint`, `@nx/jest`, `@nx/playwright`, `@nx/vite`,
`@nx/webpack`
- `packages/vitest/src/utils/ignore-vitest-temp-files.ts` lazy-loads
`@nx/eslint`
- `packages/vue/src/**` lazy-loads `@nx/cypress`, `@nx/playwright`,
`@nx/rsbuild`, `@nx/storybook`
This means tasks in those packages read files from their lazy-loaded
dependencies at module-load time without declaring them as inputs — the
motivation behind the sandbox-violation work in #35377.
## Expected Behavior
Declares each lazy-loaded package as an optional `peerDependency` with
`peerDependenciesMeta.*.optional: true`.
`explicit-package-json-dependencies` walks `peerDependencies` alongside
`dependencies`, materializing the edges in the graph. `optional: true`
keeps them off the user's install surface — package managers don't
auto-install optional peers and don't warn when they're missing.
`@nx/vitest` is already declared as a `devDependency` of `@nx/web`, so
the `web → vitest` edge is already present; no change needed there.
Follows the pattern established in #35377 (`@nx/eslint → @nx/jest`).
### Scope
Narrower subset of #35392, scoped to `@nx/storybook`, `@nx/web`,
`@nx/vitest`, and `@nx/vue`. Those four close the most commonly hit
transitive lazy-load chains (`storybook → web → jest`, `vue → storybook
→ web → jest`, `web → vitest → eslint`, etc.) without needing the
`implicitDependencies: ["!name", ...]` cycle negations that
`@nx/workspace` and `@nx/js` require in #35392.
Note: `@nx/vitest` is not covered by #35392 at all, so this PR adds at
least one edge that isn't in the broader PR.
### Verification
- Regenerated project graph locally — all new edges appear as `static`
type:
- `storybook → web`
- `web → {cypress, eslint, jest, playwright, vite, webpack}`
- `vitest → eslint`
- `vue → {cypress, playwright, rsbuild, storybook}`
- Full cycle scan: **0 cycles introduced**.
- `nx prepush` passes cleanly.
## Related Issue(s)
<!-- No open issue; follow-up to #35377 and narrower alternative to
#35392 -->
0 commit comments