Yarn: nohoist doesn't work with dependencies of a dependency

Created on 21 Feb 2019  路  4Comments  路  Source: yarnpkg/yarn

What is the current behavior?
Specifying nohoist on a package doesn't apply to it's dependencies that need to be nohoisted and even manually specifying them doesn't avoid that issue.

If the current behavior is a bug, please provide the steps to reproduce.
Run with the following package.json:

{
  "name": "test_nohoist_dep_of_dep",
  "description": "test nohoist of dependencies of a dependency",
  "dependencies": {
    "mathjs": "~5.5.0"
  },
  "workspaces": {
    "nohoist": [
      "mathjs",
      "complex.js",
      "decimal.js",
      "escape-latex",
      "fraction.js",
      "javascript-natural-sort",
      "tiny-emitter",
      "typed-function"
    ]
  }
}

What is the expected behavior?
All of the specified packages would be nohoisted

Please mention your node.js, yarn and operating system version.
node: 10.15.0
yarn: 1.13.0
os: Linux 80f336065441 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 Linux

Most helpful comment

For anyone that stumbles onto this, the way that works for this is to do:

"workspaces": {
    "nohoist": [
      "**/mathjs", "**/mathjs/**"
    ]
  }

All 4 comments

For anyone that stumbles onto this, the way that works for this is to do:

"workspaces": {
    "nohoist": [
      "**/mathjs", "**/mathjs/**"
    ]
  }

I tried and it seems to work, but I'm not 100% clear what exactly ** (two stars) before and after module do and why two entries are needed. I couldn't find any documentation on this, any explanations?

For anyone that stumbles onto this, the way that works for this is to do:

"workspaces": {
    "nohoist": [
      "**/mathjs", "**/mathjs/**"
    ]
  }

I have the same question that @matejukmar. @daveisfera Could you explain? Thank you
...
Ouu I see probably @daveisfera has that in the root/package.json ....That make sense why * before meaning any package. And I think the * after mean that package dependencies, in this case mathjs.

I am guessing here, documentation is not that clear. Correct me if I am wrong.

There's a better way to do this. See https://github.com/yarnpkg/yarn/issues/7059#issuecomment-471838362

Was this page helpful?
0 / 5 - 0 ratings