Berry: [Bug] Problem with module resolution in 'nodeLinker: node-modules' mode

Created on 23 Aug 2020  路  1Comment  路  Source: yarnpkg/berry

  • [ ] I'd be willing to implement a fix

Describe the bug (or not bug?)

yarn@berry doesn't resolve modules from root node_modules for workspaces when use nodeLinker: node-modules mode like [email protected].

To Reproduce

I created demo with description here https://github.com/inomdzhon/example-monorepo-with-yarn-berry

bug

>All comments

That's expected - root dependencies are not "inherited" by their child workspaces, it was just an unfortunate consequence of the node_modules layout. Relying on that was problematic, because if one of your transitive dependencies happened to depend on TypeScript (for example), suddenly you'd stop using the top-workspace version to instead use your transitive dependency's one.

Check this FAQ entry to see how to safely share tsc between multiple workspaces:
https://yarnpkg.com/advanced/qa#how-to-share-scripts-between-workspaces

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janicduplessis picture janicduplessis  路  4Comments

Bessonov picture Bessonov  路  4Comments

IanVS picture IanVS  路  4Comments

larixer picture larixer  路  4Comments

kiprasmel picture kiprasmel  路  3Comments