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

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
36degrees authored
of work during September 9
Diff Delta:
31
About 51 Diff Delta/hour
Classified as:  Bug Fix

36degrees' Description of Work #6498 [BUG] `bundleDependencies: true` changed back into an array after `npm install --save`

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

Building updated commit group diff...
3 total changed files
(1 file ignored)
Loading changes...