-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Using resolutions inside a workspace inner package doesn't work #5039
Comments
+1 still an issue in latest 1.7.0 |
Sigh, this is currently blocker for me, so I have to hack it somehow. :( |
@jirutka you can set the resolutions in the workspace root |
@buschtoens is right - and while it looks simple in appearance, supporting nested resolutions in the way you expect isn't trivial. In the Yarn model, a same range always resolve to the exact same version, regardless of where they are on the dependency tree. Due to this behavior, any custom resolution defined in a workspace would also apply on other workspaces, which would be counterintuitive. For this reason, the resolutions field is ignored in nested workspaces, and we instead force you to explicitly list them all in the root |
No, I've tried that, it doesn't work, resolution is just ignored. |
Makes total sense and I can keep working with that model. But seeing that there is a
What version of yarn are you on? There's also a nasty bug with resolutions and To fix this, it's usually enough to nuke the root |
Makes sense, but the No package should ever rely on its hoisting. Doing it is similar to letting users walk on a rotted wood deck then suggesting them to send a complaint to their shoemakers when it finally breaks. |
1.9.4
I've tried that without success. |
A few issues fixed here in the `typescript` theme... ### GraphQL When i brought in apollo, it upped the graphql version to 14. This was incompatible with `graphql` and `@types/graphql` 13 which was being used by `type-graphql`. Fortunately, @rmevans9 is a wizard and showed me how to fix via `yarn resolutions`. There's currently an [yarn issue](yarnpkg/yarn#5039) that requires me to put the `resolutions` in both `package.json` and `packages/reactotron-server/package.json`, but no big deal. ### tslint I brought in `ts-lint` for `reactotron-server`. ### typescript I bumped the version to `3.0.3` cuz there's some footguns in prior versions. ### tsconfig out dir changes When you `tsc` a folder that has 2 directories, both directories are copied to the `outDir`. 1 directory will only copy the contents (strangely enough). So I updated the `outDir` to reflect that. Sorry about that. That caught me off guard. ### .gitignore I promoted the `.cache` to the root `.gitignore`. This is for `parcel`, but having 1 `.gitignore` is preferable since `vscode` doesn't seem to support unioning them together nicely (to make the folders dim in the explorer view).
On yarn 1.12.3 I'm kind of seeing the opposite, where the root For example, in the root
If I do diff --git a/yarn.lock b/yarn.lock
index 4b9c0f908..e3f5dd91e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2966,12 +2966,17 @@
"@types/history" "*"
"@types/react" "*"
-"@types/react@*", "@types/react@16.4.2", "@types/react@^0.14.44":
+"@types/react@*", "@types/react@16.4.2":
version "16.4.2"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.2.tgz#f1a9cf1ee85221530def2ac26aee20f910a9dac8"
dependencies:
csstype "^2.2.0"
+"@types/react@^0.14.44":
+ version "0.14.57"
+ resolved "https://registry.yarnpkg.com/@types/react/-/react-0.14.57.tgz#1878a8654fafdd1d381b8457292b6433498c5b62"
+ integrity sha1-GHioZU+v3R04G4RXKStkM0mMW2I=
+
"@types/redis@*", "@types/redis@^2.8.6":
version "2.8.6"
resolved "https://registry.yarnpkg.com/@types/redis/-/redis-2.8.6.tgz#3674d07a13ad76bccda4c37dc3909e4e95757e7e"
However, if I copy the root I'm not sure if this is intended behaviour or not. |
It seems that |
I have the same problem. I just can't override @types/react with
using yarn 1.13.0. |
You wouldn't imagine the number of priorities that people think I should have 🙂 Yarn v2 will completely overhaul the resolution logic and will solve many shortcomings we have with the current one - afaik this particular issue is already fixed there. |
God this is so annoying 😭. And it is not mostly the yarn's fault. The package developers (even famous packages) does not respect semantic versioning in so many instances and this creates a huge mess. |
Still happens to me with the version 1.21.1 and looks to be fixed with the last version 1.22.4. The issue is still open? |
Yarn dependency resolutions seem not be fully compatible with Yarn workspaces, see yarnpkg/yarn#5039. Considering these lines didn’t have any effect for a while now, it’s arguably safer to remove them than to move them to the root package.json.
After moving to the monorepo and adding angular there was a version conflict for @storybook/theming and @emotion/core that prevented the 'Show Info' button from working on React. I set resolutions for the react package in the root package.json, because yarn will ignore resolutions in workspace packges in monorepos. See: yarnpkg/yarn#5039
Looks like we were running into a variant of: yarnpkg/yarn#5039 My "resolutions" weren't having the expected effect (we were getting both 2.4.0 and 2.2.6 of "metal-uri"), even after deleting the yarn.lock and recreating it. So here, I add an empty "workspaces" config, like the other projects under "maintenance" have (well, technically, they all have non-empty "workspaces" config) and that makes it work. Now we only have 2.2.6 in the lockfile! Note that because I deleted the lockfile before preparing this commit, it also includes some innocuous updates. The build still works.
Still happens to me on 1.22.4 and 1.22.10. |
I have the same issue even with yarn 2 :-/ |
@olee |
still actual with yarn@3.0.2 |
Jest before v27 didn't support configuration options that allow test files to be discovered across symlink boundaries, which is necessary when running Jest tests within a Bazel sandbox. Upgrade Jest and its dependencies (including a manual version resolution of jest-environment-jsdom [1] defined in pkg/ui/package.json to avoid Jest bugs [2]) to enable cluster-ui tests being run via Bazel. [1] enzymejs/enzyme-matchers#351 (comment) [2] yarnpkg/yarn#5039 Release justification: Upgrade of test dependencies Release note: None
Jest before v27 didn't support configuration options that allow test files to be discovered across symlink boundaries, which is necessary when running Jest tests within a Bazel sandbox. Upgrade Jest and its dependencies (including a manual version resolution of jest-environment-jsdom [1] defined in pkg/ui/package.json to avoid Jest bugs [2]) to enable cluster-ui tests being run via Bazel. [1] enzymejs/enzyme-matchers#351 (comment) [2] yarnpkg/yarn#5039 Release justification: Upgrade of test dependencies Release note: None
Jest before v27 didn't support configuration options that allow test files to be discovered across symlink boundaries, which is necessary when running Jest tests within a Bazel sandbox. Upgrade Jest and its dependencies (including a manual version resolution of jest-environment-jsdom [1] defined in pkg/ui/package.json to avoid Jest bugs [2]) to enable cluster-ui tests being run via Bazel. [1] enzymejs/enzyme-matchers#351 (comment) [2] yarnpkg/yarn#5039 Release justification: Upgrade of test dependencies Release note: None
Jest before v27 didn't support configuration options that allow test files to be discovered across symlink boundaries, which is necessary when running Jest tests within a Bazel sandbox. Upgrade Jest and its dependencies (including a manual version resolution of jest-environment-jsdom [1] defined in pkg/ui/package.json to avoid Jest bugs [2]) to enable cluster-ui tests being run via Bazel. [1] enzymejs/enzyme-matchers#351 (comment) [2] yarnpkg/yarn#5039 Release justification: Upgrade of test dependencies Release note: None
Jest before v27 didn't support configuration options that allow test files to be discovered across symlink boundaries, which is necessary when running Jest tests within a Bazel sandbox. Upgrade Jest and its dependencies (including a manual version resolution of jest-environment-jsdom [1] defined in pkg/ui/package.json to avoid Jest bugs [2]) to enable cluster-ui tests being run via Bazel. [1] enzymejs/enzyme-matchers#351 (comment) [2] yarnpkg/yarn#5039 Release justification: Upgrade of test dependencies Release note: None
Jest before v27 didn't support configuration options that allow test files to be discovered across symlink boundaries, which is necessary when running Jest tests within a Bazel sandbox. Upgrade Jest and its dependencies (including a manual version resolution of jest-environment-jsdom [1] defined in pkg/ui/package.json to avoid Jest bugs [2]) to enable cluster-ui tests being run via Bazel. [1] enzymejs/enzyme-matchers#351 (comment) [2] yarnpkg/yarn#5039 Release justification: Upgrade of test dependencies Release note: None
Still seems to be an issue in |
Still an issue :( This is coming up more with our NextJS app expecting one version and a package with a hard dependency expecting another. |
@arcanis, I wonder why you don't even issue warning logs in this case? |
We do, in all modern releases (ie >=2). |
These 2 messages are in conflict:
I am also having this issue where I need to specify resolutions at the base package.json with:
|
The message I'm answering to is:
Modern releases don't support the I think I'm going to lock this thread, there isn't more to say around this topic on this repo. |
Do you want to request a feature or report a bug?
A bug.
What is the current behavior?
When using a
resolutions
property in an inner package on a dependency that gets hoisted up, theresolutions
property is ignored. If moved to the root package, it resolves correctly.If the current behavior is a bug, please provide the steps to reproduce.
I've prepared an example repo with two branches -
resolution-in-root
andresolution-in-same-package
that demonstrate this.Simply checkout a branch, run
yarn
, and check the installed version of webpack. (Deletenode_modules
when moving between branches)You'll see that on the
resolution-in-root
branch, the installed version of webpack is 3.8.1 as specified in theresolutions
block, as opposed to theresolution-in-same-package
where the webpack version will not be constrained byresolutions
.What is the expected behavior?
I would expect that if a dependency and a
resolutions
property that constrain it are in the samepackage.json
, that the resolutions limitations will apply to the package, no matter where it gets hoisted to.Please mention your node.js, yarn and operating system version.
The text was updated successfully, but these errors were encountered: