berry: [Bug?]: Not finding modules in Typescript import statements

Self-service

  • I’d be willing to implement a fix

Describe the bug

Yarn VSCode SDK no longer working to find modules

To reproduce

  1. Create new folder
  2. yarn set version berry
  3. yarn init
  4. Create new file index.ts
  5. yarn add typescript -D
  6. write in index.ts import React from 'react'
  7. yarn add react
  8. yarn dlx @yarnpkg/sdks vscode
  9. Set Typescript version in VSCode to 4.4.2-sdk

Environment

System: OS: Windows 10 10.0.19043 CPU: (4) x64 Intel® Core™ i5-7600 CPU @ 3.50GHz Binaries: Node: 14.17.4 - C:\Users\user\AppData\Local\Temp\xfs-f520d191\node.CMD Yarn: 3.0.1 - C:\Users\user\AppData\Local\Temp\xfs-f520d191\yarn.CMD npm: 7.11.1 - C:\Program Files\nodejs\npm.CMD

Additional context

Yarn v3.0.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Set Typescript version in VSCode to 4.4.2-sdk

I missed the version number, sorry about that. TypeScript 4.4 doesn’t have the PnP patch yet, will be fixed by https://github.com/yarnpkg/berry/pull/3297, you can either run

yarn set version from sources --branch 3297 && yarn

to get the update now or downgrade to TypeScript 4.3

EDIT: Released in 3.0.2 so the command is now

yarn set version berry && yarn

The fix has been released as 3.0.2 so you can now the following to fix it

yarn set version berry && yarn

Been stuck on this for a while. Luckily I searched the issues and removed the “is:open” filter 😃

The SDK is unrelated here so yarn up typescript@~4.3 would change all your direct typescript dependencies to ~4.3

@merceyz Unfortunately that does not solve the issue. Ran yarn add -D @types/react. No difference.

This is not a React specific issue. All modules are not found unless they are relative paths.