fix!: refuse to pack when overrides apply to bundled packages#9271
Merged
owlstronaut merged 1 commit intolatestfrom Apr 28, 2026
Merged
fix!: refuse to pack when overrides apply to bundled packages#9271owlstronaut merged 1 commit intolatestfrom
owlstronaut merged 1 commit intolatestfrom
Conversation
Member
|
What if we have overridden dev dependencies? |
Contributor
Author
those are good points. I'll need to make this a little more flexible |
8cf2689 to
700f297
Compare
700f297 to
f6981d5
Compare
wraithgar
reviewed
Apr 23, 2026
wraithgar
reviewed
Apr 23, 2026
wraithgar
reviewed
Apr 23, 2026
wraithgar
reviewed
Apr 23, 2026
wraithgar
reviewed
Apr 23, 2026
f6981d5 to
649aaad
Compare
wraithgar
reviewed
Apr 28, 2026
BREAKING CHANGE: npm pack and npm publish now error when a package's overrides apply to one or more of its bundled packages (bundledDependencies / bundleDependencies). Defining both fields is still allowed as long as no override actually targets a bundled package. To resolve the error, remove the affected entries from either overrides or the bundle.
649aaad to
4568721
Compare
wraithgar
approved these changes
Apr 28, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow up to #9235.
When a package defines
overridesthat apply to one or more of itsbundledDependencies(orbundleDependencies), the resulting bundled tree is invalid from the perspective of any consumer: consumers do not apply the publishing package's overrides when validating the bundled tree, sonpm lswill always show invalid edges for the affected bundled packages.This PR refuses to pack (and therefore publish) such packages with a clear
EBUNDLEOVERRIDEerror that lists the offending bundled package names. Defining bothoverridesandbundledDependenciesis still allowed — the error only fires when an override actually targets a package inside the bundled subtree. Cases that are now correctly accepted include:The check uses Arborist's own
inBundle/inDepBundle/overriddensemantics on the actual on-disk tree (the same tree pacote uses to build the tarball), so it stays consistent with whatnpm-packlistactually publishes.The check lives in
libnpmpack, so it coversnpm pack,npm publish, and any direct consumers of the library.Closes npm/statusboard#1102.
BREAKING CHANGE: npm pack and npm publish now error when a package's overrides apply to one or more of its bundled packages (
bundledDependencies/bundleDependencies). Defining both fields is still allowed as long as no override actually targets a bundled package. To resolve the error, remove the affected entries from eitheroverridesor the bundle.