-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Implement overrides
for package.json
#1134
Comments
I'm having the same issue when using overrides with Bun 0.2.1, I see is not supported yet, a temporary solution as you mentioned was using |
This would be a great feature for bun! npm/pnpm calls this overrides. Yarn v1 calls it resolutions. |
+1 |
This was one of the blockers for me when I attempted to migrate an app to bun as well. With a large enough app, packages with broken dependencies are pretty inevitable. Having some way to deal with these either through patching (requested here) and/or overrides is a life saver. Bun is missing both at the moment unfortunately. |
is only one level deep okay? like {
"overrides": {
"lodash": "npm:lodash-es@latest"
}
} and not supporting {
"overrides": {
"react": {
"react-dom": "16.0.0"
}
}
} |
Can't speak for others in this thread, but 1 level would be enough to unblock my use case. Most of the time, I'm using overrides to force dedupe to a single good version, so don't need the deeper levels. Would be a great place to start if it makes implementation simpler imo. 🙂 |
1 level deep now unblocks us too 👍🏽 |
would make debugging a hell lot easier. this is a must have feature in the node ecosystem. cross-referencing #4669 |
Currently also blocking us from being able to utilize Our current workaround is to install all dependencies via |
Also for us. |
|
aw man. was hoping to migrate today until I found this issue 😢 |
waiting for oven-sh/bun#1134
waiting for oven-sh/bun#1134
Is there a workaround for this at the moment? Trying to replace |
@Jarred-Sumner has work on this already started? I was going to give it a go, but still working on getting |
@ricklove I attempted to work through this and unfortunately the Zig codebase is very difficult to work on. I would hold off on this and let @Jarred-Sumner take a look since he's the most experienced with that part of the system, which is one of the older parts of the codebase (ported from a Go repository) as far as I can tell. |
|
Are the overrides/resolutions monorepo-wide or per project? |
I just wasted a few hours trying to resolve a typescript conflict where
I tried to move the I followed this tutorial so I had placed the Maybe this helps somebody. Maybe it's expected behavior, but it worked with yarn. |
On another note, when having
So basically
I know it is rather confusing, so here's my terminal log which shows exactly what happened. Comments are in : ➜ paldock-react git:(fix/non-working) ✗ cat package.json | grep @types/react
<redacted types, following lines are in resolutions key>
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.13"
➜ paldock-react git:(fix/non-working) ✗ bun update
[0.20ms] ".env.production"
bun update v1.0.6 (969da088)
+ @types/ckeditor@4.9.10
+ @types/draft-js@0.11.13
+ @types/draftjs-to-html@0.8.2
+ @types/dragula@3.7.2
+ @types/google-map-react@2.1.8
+ @types/html-to-draftjs@1.4.1
+ @types/jest@29.5.5
+ @types/react-beautiful-dnd@13.1.5
+ @types/react-dates@21.8.4
+ @types/react-draft-wysiwyg@1.13.5
+ @types/react-helmet@6.1.7
+ @types/react-redux@7.1.27
+ @types/react-router-dom@5.3.3
+ @types/react-select@5.0.1
+ @types/react-swipeable-views@0.13.3
+ @types/react-swipeable-views-utils@0.13.5
+ @types/react-syntax-highlighter@15.5.8
+ @types/react-text-mask@5.4.12
+ @types/styled-components@5.1.28
+ @mui/icons-material@5.14.13
+ @mui/lab@5.0.0-alpha.148
+ @mui/styles@5.14.13
+ @mui/x-date-pickers@5.0.20 (v6.16.2 available)
170 packages installed [4.28s]
➜ paldock-react git:(fix/non-working) ✗ ls node_modules/@mui/base/node_modules/@types/
react --- this should not be here already
➜ paldock-react git:(fix/non-working) ✗ cat package.json | grep @types/react
<redacted types, following lines are in resolutions key - changed to static version>
"@types/react": "18.2.28",
"@types/react-dom": "18.2.13"
➜ paldock-react git:(fix/non-working) ✗ bun update
[0.20ms] ".env.production"
bun update v1.0.6 (969da088)
Checked 4985 installs across 2460 packages (no changes) [3.56s]
➜ paldock-react git:(fix/non-working) ✗ ls node_modules/@mui/base/node_modules/@types/
react <this should not be here already>
➜ paldock-react git:(fix/non-working) ✗ rm -rf node_modules/@mui/ node_modules/@types/ <this fixes the problem>
➜ paldock-react git:(fix/non-working) ✗ bun update
[0.17ms] ".env.production"
bun update v1.0.6 (969da088)
+ @types/ckeditor@4.9.10
+ @types/draft-js@0.11.13
+ @types/draftjs-to-html@0.8.2
+ @types/dragula@3.7.2
+ @types/google-map-react@2.1.8
+ @types/html-to-draftjs@1.4.1
+ @types/jest@29.5.5
+ @types/react-beautiful-dnd@13.1.5
+ @types/react-dates@21.8.4
+ @types/react-draft-wysiwyg@1.13.5
+ @types/react-helmet@6.1.7
+ @types/react-redux@7.1.27
+ @types/react-router-dom@5.3.3
+ @types/react-select@5.0.1
+ @types/react-swipeable-views@0.13.3
+ @types/react-swipeable-views-utils@0.13.5
+ @types/react-syntax-highlighter@15.5.8
+ @types/react-text-mask@5.4.12
+ @types/styled-components@5.1.28
+ @mui/icons-material@5.14.13
+ @mui/lab@5.0.0-alpha.148
+ @mui/styles@5.14.13
+ @mui/x-date-pickers@5.0.20 (v6.16.2 available)
168 packages installed [3.07s]
➜ paldock-react git:(fix/non-working) ✗ ls node_modules/@mui/base/node_modules/@types/
ls: node_modules/@mui/base/node_modules/@types/: No such file or directory <WORKS!> Interestingly enough, when i
When I change it to ^18.2.23 (^18.2.22 doesn't change anything), I get only this in the lock file:
diff ➜ paldock-react git:(a5f18265) ✗ diff yarn3.lock yarn4.lock
3c3
< # bun ./bun.lockb --hash: 96F88981FD1285FE-8f4e5bdc57fdaeae-077C884C79C4FE56-7d7746e92ed9105b
---
> # bun ./bun.lockb --hash: F21E403871B567FC-8c349ecf9bbc232a-81F761BE40AAEACC-bbfcc1cf6ce649bb
5862c5862
< "@types/prop-types@*", "@types/prop-types@^15.7.5":
---
> "@types/prop-types@^15.7.5":
5901,5910c5901
< "@types/react@*", "@types/react@>=16.8", "@types/react@^16.8 || ^17.0 || ^18.0", "@types/react@^16.9.0 || ^17.0.0 || ^18.0.0", "@types/react@^17.0.0 || ^18.0.0":
< version "18.2.22"
< resolved "https://registry.npmjs.org/@types/react/-/react-18.2.22.tgz"
< integrity sha512-60fLTOLqzarLED2O3UQImc/lsNRgG0jE/a1mPW9KjMemY0LMITWEsbS4VvZ4p6rorEHd5YKxxmMKSDK505GHpA==
< dependencies:
< "@types/prop-types" "*"
< "@types/scheduler" "*"
< csstype "^3.0.2"
<
< "@types/react@*", "@types/react@>=16":
---
> "@types/react@*", "@types/react@>=16", "@types/react@>=16.8", "@types/react@^16.8 || ^17.0 || ^18.0", "@types/react@^16.9.0 || ^17.0.0 || ^18.0.0", "@types/react@^17.0.0 || ^18.0.0":
6065,6069d6055
< version "0.16.3"
< resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz"
< integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==
<
< "@types/scheduler@*":
and it actually is what changes the behavior (including or not including the node_modules inside Also, Bun installed |
I appreciate the work on this. Is it unreasonable to expect that the package resolution behavior for Bun matches |
My org requires Veracode to scan packages. Having nested resolutions has saved me a few times. |
Support for If you need support for nested overrides, follow #6608 for updates. |
I'm running into some issue using URLs. In yarn this would work:
but in Bun I'm getting # bun install --verbose
Request: GET /beorn/slate/raw/custom/packages/slate/package.tgz
Connection: keep-alive
User-Agent: Bun/1.0.7
Accept: */*
Host: github.com
Accept-Encoding: gzip, deflate
Response: < 302 Found
< Server: GitHub.com
< Date: Sat, 21 Oct 2023 03:56:43 GMT
< Content-Type: text/html; charset=utf-8
< Vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With
< Access-Control-Allow-Origin: https://render.githubusercontent.com
< Location: https://raw.githubusercontent.com/beorn/slate/custom/packages/slate/package.tgz
[...]
Request: GET /beorn/slate/custom/packages/slate/package.tgz
Connection: keep-alive
User-Agent: Bun/1.0.7
Accept: */*
Host: raw.githubusercontent.com
Accept-Encoding: gzip, deflate
Response: < 200 OK
< Connection: keep-alive
< Content-Length: 237470
[...]
< X-GitHub-Request-Id: 890A:93AB:5E423D:73F53D:65334ADD
[...]
< Source-Age: 285
[425.94ms] Downloaded slate tarball
[slate] Start extracting .863fac336a9a6640slate
CHANGELOG.md
Readme.md
dist/create-editor.d.ts
package.json
[...]
[slate] Extracted
error: slate@^0.94.1 failed to resolve |
What is the problem this feature will solve?
The dependencies of your project might use old versions of their dependencies. I hat the problem, that lmdb was incompatible with my processor (Apple M2). I had to override the lmdb version to get my project running.
What is the feature you are proposing to solve the problem?
npm has a option called overrides in the
package.json
. This allows to use another version of a dependency you have no control over.For me, this was:
What alternatives have you considered?
using the good old npm
The text was updated successfully, but these errors were encountered: