Skip to content

Import error with workspaces using yarn 2 (berry) PnP #8757

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

Closed
oscar-b opened this issue Apr 1, 2020 · 3 comments
Closed

Import error with workspaces using yarn 2 (berry) PnP #8757

oscar-b opened this issue Apr 1, 2020 · 3 comments

Comments

@oscar-b
Copy link

oscar-b commented Apr 1, 2020

Describe the bug

When setting up a CRA project with yarn workspaces, importing a library in the same workspace fails when using yarn 2 berry which has PnP mode by default.

Environment

Environment Info:

current version of create-react-app: 3.4.1
running from /Users/oscar/.config/yarn/global/node_modules/create-react-app

System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 2.0.0-rc.31 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 80.0.3987.149
Firefox: 73.0.1
Safari: 13.1
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found

Steps to reproduce

See steps in repo: https://github.com/oscar-b/styled-pnp/commits/cra-berry-workspaces

Expected behavior

It should compile.

Actual behavior

$ yarn build
Creating an optimized production build...
Failed to compile.

./src/App.js
You attempted to import /Users/oscar/dev/test/styled-pnp/.yarn/$$virtual/lib-virtual-7d458e3583/1/lib which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.

Reproducible demo

https://github.com/oscar-b/styled-pnp/commits/cra-berry-workspaces

@stale
Copy link

stale bot commented May 1, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label May 1, 2020
@stale
Copy link

stale bot commented May 6, 2020

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed May 6, 2020
@oscar-b
Copy link
Author

oscar-b commented May 6, 2020

This is still relevant and needs triage.

@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant