Skip to content
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

Yarn, VSCode, react-ts, cannot find modules on new project #19521

Closed
7 tasks done
4imble opened this issue Feb 26, 2025 · 2 comments
Closed
7 tasks done

Yarn, VSCode, react-ts, cannot find modules on new project #19521

4imble opened this issue Feb 26, 2025 · 2 comments

Comments

@4imble
Copy link

4imble commented Feb 26, 2025

Describe the bug

I have run yarn create vite my-app --template react-ts and it has generated a project.

The project is not happy at all in VsCode and can not find any of the imported modules.

Image

For whatever reason the reproduction URL does not suffer the same issue and honestly, the issue seems to be with yarn using pnp.

I managed to make it work after generating the project and adding a .yarnrc.yml with

enableGlobalCache: false
nodeLinker: node-modules

Reproduction (Does not reproduce with the same steps as above)

https://stackblitz.com/edit/vitejs-vite-d5pkqyku?file=react-ts%2Fsrc%2FApp.tsx

Steps to reproduce

yarn create vite my-app --template react-ts
cd my-app
yarn
Open VS Code see errors on all imports

System Info

Windows
`yarn : 4.5.3`
`Typescript: 5.7.3`
`Node: 22.3.0`

Used Package Manager

yarn

Logs

No response

Validations

@hi-ogawa
Copy link
Collaborator

Yarn pnp doesn't work on vscode typescript out-of-the-box. This is not related to vite and please check out their doc https://yarnpkg.com/getting-started/editor-sdks

@4imble
Copy link
Author

4imble commented Feb 26, 2025

That's fair enough, but do you know why when using the yarn create command it is defaulting to using PnP? Looking at the documentation it seems to suggest if you dont have a .yarnrc.yml it will do this, should it be added part of the react-ts project structure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants