0

I have a project structure like so:

library/
- package.json
- example/
--- package.json

My example package is a CRA. Until now, to be able to have my 'example' package use the parent folder as a package library, I would do these 2 simple commands:

  • in 'library' - yarn link
  • in 'example' - yarn link library

This worked like a charm, creating a symlink from 'example/node_modules/library' to the library folder itself. Now, however, I have decided to upgrade to yarn v3.5.0, which has made some things better, but I can't get my setup to work. 'example' fails to compile with "unable to resolve 'library'" error.

I have tried everything suggested in other questions, such as this one:

  • yarn link ../ - 'example' still doesn't compile
  • yarn add library@file:../ - command executes forever, stuck at "resolving dependencies"
  • yarn add library@portal:../ or yarn add library@link:../ - it adds it to package.json, but doesn't create a symlink in 'node_modules', gives warning YN0072, 'example' still fails to compile

The only solution I've found is to downgrade yarn back to v1.22. Is there a way to have this setup working correctly in v3.5.0?

Chaoz
  • 2,119
  • 1
  • 20
  • 39

0 Answers0