Open soneymathew opened 1 year ago
This would be helpful in mitigating findings from security scans, where the immediate dependency may not have the fix, but I know I can safely bump the nested dependency.
+1
+1
Currently pdfjs-dist
can't be used with bun because it doesn't support node_module_register
and therefore canvas
. This could be solved if we bun add canvas@npm:@napi-rs/canvas
and:
"overrides": {
"pdfjs-dist": {
"canvas": "$canvas"
}
}
I'm sure many other packages would benefit from nested overrides, especially in cases where there is a dependency that's not yet supported by bun but that has other dependencies that mimic the api but don't depend on node-specific functionality.
For others with a similar problem for now I had to:
bun add canvas@npm:@napi-rs/canvas
rsync -a --delete node_modules/canvas/ node_modules/pdfjs-dist/node_modules/canvas
I added the second command to the "postinstall" script to make it something reproducible.
+1
warn: Bun currently does not support nested "overrides"
Is there any work being done on this yet?
Currently
pdfjs-dist
can't be used with bun because it doesn't supportnode_module_register
and thereforecanvas
. This could be solved if webun add canvas@npm:@napi-rs/canvas
@gerardmarquinarubio as of Bun v1.1.13, you can do this as an alternative to nested overrides for that specific scenario:
"overrides": {
"canvas": "npm:@napi-rs/canvas@latest"
}
This installs @napi-rs/canvas
into node_modules/canvas
. This is not nested overrides, as nested overrides supports only applying to a specific dependency - this applies everywhere.
Currently
pdfjs-dist
can't be used with bun because it doesn't supportnode_module_register
and thereforecanvas
. This could be solved if webun add canvas@npm:@napi-rs/canvas
@gerardmarquinarubio as of Bun v1.1.13, you can do this as an alternative to nested overrides for that specific scenario:
"overrides": { "canvas": "npm:@napi-rs/canvas@latest" }
This installs
@napi-rs/canvas
intonode_modules/canvas
. This is not nested overrides, as nested overrides supports only applying to a specific dependency - this applies everywhere.
I see, totally missed it from the docs:
Add bar to the "overrides" field in package.json. Bun will defer to the specified version range when determining which version of bar to install, whether it's a dependency or a metadependency.
Didn't cross my mind that "metadependency" refers to dependencies of dependencies, but it totally makes sense.
The typical term for that is “transitive dependency”, fwiw.
We're facing difficulties with the latest Next 15 release & bun as a package manager, as most react/next related dependencies still use React 18, there's no current way for us to pin React 19 as a nested resolution.
Is it still planned for Q4?
Same issue on Nestjs app, with docusign-esign/**/cookiejar
and @temporalio/interceptors-opentelemetry/**/@opentelemetry/resources
resolutions
What version of Bun is running?
1.0.6+969da088f5db3258a803ec186012e30f992829b4
What platform is your computer?
Darwin 23.0.0 arm64 arm
What steps can reproduce the bug?
in package.json add nested resolutions
example from a package.json that failed bun install
What is the expected behavior?
bun install should succeed without errors
What do you see instead?
I see
Additional information
No response