npm-packlist icon indicating copy to clipboard operation
npm-packlist copied to clipboard

[BUG] `bundledDependencies` does not work in NPM workspaces subpackage

Open aloisklink opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

bundledDependencies does not work when using NPM's new workspaces feature.

The node_modules folder is no longer in the subpackage, only in the root package, so the bundledDependencies field no longer works.

Expected Behavior

Running npm pack --workspaces should pack bundledDependencies stored in my subpackage's package.json file.

Steps To Reproduce

Create a new folder and run the following to generate a package.json and a subpackage/package.json file.

npm init -f && npm init -f -w subpackage

Then add the following lines to both package.json and subpackage/package.json:

"dependencies": {"tar": "*"},
"bundledDependencies": ["tar"],

Then, do an npm install && npm pack --workspaces. You should see that npm pack correctly has a === Bundled Dependencies === line, while npm pack --workspaces does not.

Environment

  • npm: 8.10.0
  • Node: v16.13.0
  • OS: Ubuntu 22.04
  • platform: Intel x86_64 processor: i7-1165G7

aloisklink avatar May 12 '22 21:05 aloisklink

It's possible this is the same root cause as https://github.com/npm/cli/issues/5320. I'm linking these two issues so as we can look into both at the same time.

lukekarrys avatar Sep 23 '22 02:09 lukekarrys