Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pnpm does not bundle subdependencies #8024

Open
2 of 4 tasks
micash545 opened this issue Apr 27, 2024 · 1 comment
Open
2 of 4 tasks

Pnpm does not bundle subdependencies #8024

micash545 opened this issue Apr 27, 2024 · 1 comment

Comments

@micash545
Copy link

micash545 commented Apr 27, 2024

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

v9.0.6

Which area(s) of pnpm are affected? (leave empty if unsure)

CLI, Package manager compatibility

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

Try to pnpm pack package with installed dependencies with pnpm with bundled dependencies.

Describe the Bug

Pnpm not bundling subdependencies (node_modules/package/node_modules) like in photo.
Package.json:

  "dependencies": {
    "node-gyp": "^10.1.0"
  },
  "bundleDependencies": [
    "node-gyp"
  ],
...

Pnpm:
image
Npm:
image

The issue could be coused by pnpm linking strategy.
when using npm pack node_modules installed by pnpm breaks the .tgz archive.

npm notice 549B    ../../node_modules/.pnpm/foreground-child@3.1.1/node_modules/cross-spawn/lib/util/readShebang.js                       
npm notice 1.6kB   ../../node_modules/.pnpm/foreground-child@3.1.1/node_modules/cross-spawn/lib/util/resolveCommand.js                    
npm notice 1.1kB   ../../node_modules/.pnpm/foreground-child@3.1.1/node_modules/cross-spawn/LICENSE                                       
npm notice 1.7kB   ../../node_modules/.pnpm/foreground-child@3.1.1/node_modules/cross-spawn/package.json                                  
npm notice 4.7kB   ../../node_modules/.pnpm/foreground-child@3.1.1/node_modules/cross-spawn/README.md

Expected Behavior

Pnpm should also bundle subdependencies (node_modules/package/node_modules) like npm.

Which Node.js version are you using?

v20.10.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Arch Linux

@KSXGitHub
Copy link
Contributor

bundleDependencies right now only work with node-linker=hoisted (you may add node-linker=hoisted to .npmrc). It is our oversight that we did not error when user tries it without node-linker=hoisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants