-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Absolute imports do not work when Yarn PnP is enabled #7996
Comments
Can reproduce! Related issue: #7047 I get this error when I run
I'm not using create-react-app, but the setup is similar: I want PnP to realize that TypeScript knows how to resolve these paths. |
For people coming from search engines, I think this is the issue to subscribe to: yarnpkg/berry#589 |
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. |
@hlian Thanks for the confirmation and sharing the related issue with regards to Typescript. However, I see this issue with regular JavaScript as well. It seems yarnpkg/berry#589 is Typescript specific. |
Any update on this? main breaking point for upgrade to yarn berry |
Yarn 2/berry already fixed this, you just need to tell it how to resolve each module in |
This may work in a single repo, but not working with typescript + monorepo |
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. |
It seems like this should work with Yarn 2 as long as workspaces aren’t used yarnpkg/berry#589 (comment) |
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. |
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. |
I created a React App using create-react-app with PnP enabled.
npx create-react-app pnp --use-pnp
Then following the documentation, I created a jsconfig.json file to enable absolute imports.
https://create-react-app.dev/docs/importing-a-component/#absolute-imports
When I use absolute imports, the compiler fails to resolve those. Changing the imports to have relative paths work. Just to see whether this is PnP related, I deleted the '.pnp.js' file and removed the relevant config from package.json as well. Then it worked fine. So I assume this is PnP related.
Environment: create-react-app v3.2.0 on Mac OS X Catalina
The text was updated successfully, but these errors were encountered: