[BUG] VSCode can't resolve node API if Playwright project exists in subdirectory
See original GitHub issueContext:
- Playwright Version: 1.27.0
- Operating System: Windows 11
- Node.js version: 18.7
- Browser: All
Code Snippet
# Init new Playwright project in a subdirectory of the repo
mkdir my-tests
cd my-tests
npm init playwright@latest
# This VSCode instance works fine
code .
# This VSCode instance can't resolve node API
cd ..
code . --new-window
Describe the bug
VSCode can’t resolve node API if the Playwright project is created in a sub directory. However, everything seems to work fine when running the project, so only DX is affected.
Solution to bug
Adding an empty tsconfig.ts to the Playwright project.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
What could cause an error related to npm not being able to ...
Try the following steps: 1. Make sure you have the latest npm (npm install -g npm). 2. Add an exception to your antivirus...
Read more >Visual Studio Code Workspace Trust security
The Workspace Trust feature lets you decide whether code in your project folder can be executed by VS Code and extensions without your...
Read more >VS Code API | Visual Studio Code Extension API
VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This page lists all...
Read more >Source Control with Git in Visual Studio Code
Your browser can't play this video. ... Tip: You can open VS Code in a sub-directory of a Git repository. VS Code's Git...
Read more >User and Workspace Settings - Visual Studio Code
A setting shows up under this filter if its value differs from the default value, or if its value is explicitly set in...
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
Yup, I can repro, opening VS Code in the outer folder does not resolve Node types. Interestingly, VS Code is smart enough to suggest that I install @types/node. Which I can clearly see installed under the node_modules, which is in the folder containing my config. I.e. it should resolve this dependency when it starts resolving from playwright.config.ts per Node rules. Looks like something VS Code team could look at!
Closing per the response above, there is no further action planned on playwright end. @Torsteinws please file a bug with VS Code to have them fix it.