fix(arborist): preserve `bundleDependencies: true` when saving package.json #9958

Open
36degrees opened 5:13am on September 9, 2026 wants to merge 31 Ξ” into npm/cli latest from
preserve-bundle-dependencies-true

Pull Request Overview

  • Opened on September 9, 2026
  • Status Open
  • Commit count 2 with first commit September 9, 2026

Total Delta

31 Total Diff Delta

Open Days

Open 8 weekdays

Test Delta

12 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Data pending calculation for pull request

Author avatar

fix(arborist): preserve `bundleDependencies: true` when saving package.json

If the original package.json used bundleDependencies: true, preserve that boolean value when updating package.json, rather than overwriting it with the normalized list of packages.


[!NOTE]
This is my first time contributing to the codebase – please review with this in mind. I had some help from CoPilot understanding the codebase and where the change should be made, but the code changes are my own.


References

Fixes #6498

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

bundleDependencies gets normalized into an array when package.json is saved.

Expected Behavior

bundleDependencies remains true.

Steps To Reproduce

  1. Have bundleDependencies: true in your package.json
  2. npm install a new dependency

Environment

  • npm: 9.6.5
  • Node.js: 18.14.2
  • OS Name: macOS
  • System Model Name:
  • npm config: ini ; copy and paste output from `npm config ls` here

No comments have been left on this PR.