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

Add node-gyp as peer dependency #489

Open
DecathectZero opened this issue Aug 6, 2024 · 1 comment
Open

Add node-gyp as peer dependency #489

DecathectZero opened this issue Aug 6, 2024 · 1 comment

Comments

@DecathectZero
Copy link

DecathectZero commented Aug 6, 2024

This is a bit of an edge case, but we use yarn as our package manager, and it annoyingly has this code in it:
https://github.com/yarnpkg/berry/blob/9c3dc22b7e3c2a2c0782ee1222b4cf9ac6a2846f/packages/plugin-npm/sources/NpmSemverResolver.ts#L144-L155

Basically it will always add node-gyp as a production dependency in the lock file:

"isolated-vm@npm:^5.0.1":
  version: 5.0.1
  resolution: "isolated-vm@npm:5.0.1"
  dependencies:
    node-gyp: "npm:latest"
    prebuild-install: "npm:^7.1.1"

This causes our production build, (with yarn workspaces focus --production or npm prune --production) which needs to be as small as possible, to also include the entire node-gyp package and all it's dependencies.

If you read the yarn code, as long as node-gyp gets listed as a peer dependency, it's good. I can add it as a dev dependency to my repo.

Hopefully this doesn't affect those using npm either - I understand node-gyp is just bundled in with npm anyways.

@laverdet
Copy link
Owner

laverdet commented Aug 6, 2024

If build size is important to you then you should be using a bundler like esbuild, webpack, etc.

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

No branches or pull requests

2 participants