fix(core): resolve published nx migrate package resolution#35013
Merged
FrozenPandaz merged 1 commit intomasterfrom Mar 25, 2026
Merged
fix(core): resolve published nx migrate package resolution#35013FrozenPandaz merged 1 commit intomasterfrom
FrozenPandaz merged 1 commit intomasterfrom
Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
View your CI Pipeline Execution ↗ for commit 49c9313
☁️ Nx Cloud last updated this comment at |
FrozenPandaz
approved these changes
Mar 25, 2026
FrozenPandaz
pushed a commit
that referenced
this pull request
Mar 26, 2026
## Current Behavior When `nx migrate latest` runs, it installs the target version of `nx` into a temporary directory and executes that published CLI. During migration, Nx checks whether `nx` is already installed in the workspace by resolving `nx/package.json`. This used to resolve through the workspace-oriented lookup paths, so migrate correctly detected the workspace-installed `nx` package and expanded the first-party Nx package group. That changed recently with `chore(core): build nx to local dist and use nodenext (#34111)`. As part of that work, the published `nx` package gained an `exports` map. In Node, a package with `name: "nx"` and `exports` can self-reference by package name. As a result, when code running inside the temporary published `nx` package resolves `nx/package.json`, Node now resolves that request back to the temporary package itself. The resolved path points outside the workspace root, so migrate's existing safety check treats `nx` as not installed in the workspace. Once that happens, migrate only updates `nx` and never expands the rest of the first-party Nx package group. Separately, provenance package-group lookup assumes a source-layout-relative path to `package.json`, which does not hold for published artifacts built into local `dist/`. ## Expected Behavior Published temporary migrate CLIs should still resolve the workspace-installed `nx` package when migrate determines what is installed in the workspace. That preserves the existing package-group migration behavior even after the recent `exports`-based packaging change. Provenance package-group lookup should resolve the manifest of the currently running `nx` package in a way that works for published artifacts as well as source checkouts. (cherry picked from commit 0a38129)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
When
nx migrate latestruns, it installs the target version ofnxinto a temporary directory and executes that published CLI. During migration, Nx checks whethernxis already installed in the workspace by resolvingnx/package.json.This used to resolve through the workspace-oriented lookup paths, so migrate correctly detected the workspace-installed
nxpackage and expanded the first-party Nx package group.That changed recently with
chore(core): build nx to local dist and use nodenext (#34111). As part of that work, the publishednxpackage gained anexportsmap. In Node, a package withname: "nx"andexportscan self-reference by package name. As a result, when code running inside the temporary publishednxpackage resolvesnx/package.json, Node now resolves that request back to the temporary package itself.The resolved path points outside the workspace root, so migrate's existing safety check treats
nxas not installed in the workspace. Once that happens, migrate only updatesnxand never expands the rest of the first-party Nx package group.Separately, provenance package-group lookup assumes a source-layout-relative path to
package.json, which does not hold for published artifacts built into localdist/.Expected Behavior
Published temporary migrate CLIs should still resolve the workspace-installed
nxpackage when migrate determines what is installed in the workspace. That preserves the existing package-group migration behavior even after the recentexports-based packaging change.Provenance package-group lookup should resolve the manifest of the currently running
nxpackage in a way that works for published artifacts as well as source checkouts.