[Bug?]: Not finding modules in Typescript import statements
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
Yarn VSCode SDK no longer working to find modules
To reproduce
- Create new folder
yarn set version berryyarn init- Create new file
index.ts yarn add typescript -D- write in
index.tsimport React from 'react' yarn add reactyarn dlx @yarnpkg/sdks vscode- 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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Common TypeScript module problems and how to solve them
Solution 2: Locate the module and resolve imports ; "*" value in the array means the exact name of the module, while the...
Read more >Typescript - Importing a Module - Cannot Find Module
Quick solution: Use ts-node to run your TypeScript files directly npm install --dev ts-node. Start a node process with this command:
Read more >TypeScript: Cannot use import statement outside a module
To solve the error "Cannot use import statement outside a module" in TypeScript, set the module option to commonjs in your tsconfig.json file...
Read more >Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >Cannot use import statement outside a module [React ...
How to Fix the TypeScript SyntaxError: Cannot use import statement outside a module Error · Install the latest version of TypeScript, and are ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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
to get the update now or downgrade to TypeScript 4.3
EDIT: Released in
3.0.2so the command is nowThe fix has been released as
3.0.2so you can now the following to fix it