Nx
Enterprise
Nx
fix(core): prevent nx migrate crash when include=optional filters out the target package (#36087) ## Current Behavior `nx migrate --include=optional` crashes with `Cannot read properties of undefined (reading 'version')`. The target package sits in its own required closure, so the Migrator drops its `packageUpdates` entry; `generateMigrationsJsonAndUpdatePackageJson` then reads `.version` off it unguarded when building the `writePromptMigrationFiles` argument. ## Expected Behavior Resolve the target version defensively (`packageUpdates[walkedTargetPackage]?.version ?? opts.targetVersion`, the same form already used for completion analytics); optional migrate completes without crashing. ## Related Issue(s) Fixes NXC-4590 <!-- polygraph-session-start --> --- [View session information ↗](https://snapshot.app.trypolygraph.com/orgs/69cdc268b6aa527e4129c2b4/sessions/migrate-error-c1c6a147) <!-- polygraph-session-end --> --------- Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
nx-cloud record -- pnpm nx-cloud conformance:check
Sign in / Sign up
Open main menu
Succeeded
CI Pipeline Execution
1 run failed
nx-cloud record -- pnpm nx-cloud conformance:check
Click to copy
Linux
4 CPU cores
c8f308f8
master