Skip to content

fix(nx-plugin): include overrides in generated package-lock.json#34666

Closed
christopher-drifte wants to merge 2 commits intonrwl:masterfrom
christopher-drifte:fix/npm-overrides-lockfile
Closed

fix(nx-plugin): include overrides in generated package-lock.json#34666
christopher-drifte wants to merge 2 commits intonrwl:masterfrom
christopher-drifte:fix/npm-overrides-lockfile

Conversation

@christopher-drifte
Copy link
Copy Markdown

@christopher-drifte christopher-drifte commented Mar 2, 2026

Current Behavior

When using Nx to generate a pruned package-lock.json with npm overrides defined in the root package.json, the override packages and their transitive dependencies are not included in the generated lockfile. This causes npm install to fail in the pruned context.

Minimum reproduction: https://github.com/chrisdrifte/minimatch-override-repro

Expected Behavior

The generated package-lock.json should include all packages specified in npm overrides (from package.json#overrides), along with their transitive dependencies, ensuring successful npm installs.

Documentation: https://docs.npmjs.com/cli/v11/configuring-npm/package-json#overrides

Related Issue(s)

Fixes #34529

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 2, 2026

Deploy Preview for nx-docs canceled.

Name Link
🔨 Latest commit 99d65cf
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69a5b1265dc7440008e2cef5

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 2, 2026

Deploy Preview for nx-dev canceled.

Name Link
🔨 Latest commit 7e2e4f7
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69a6c32a4f2137000882615f

Comment thread packages/nx/src/plugins/js/lock-file/npm-parser.ts
The seenPackages Set was initialized once at the function level and shared across all overridden
packages. This caused transitive dependencies to be incorrectly skipped when multiple overridden
packages shared common dependencies.
@christopher-drifte
Copy link
Copy Markdown
Author

Fixed by #35192

@github-actions
Copy link
Copy Markdown
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.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@nx/next:build with generateLockfile: true ignores npm overrides when generating package-lock.json

1 participant