Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a 'jsconfig.json' file for Visual Studio Code

I am fairly new to Visual Studio Code and have been following a tutorial to create Node.js applications with Visual Studio Code.

I need to create a jsconfig.json file, the tutorial informs me that there should be a green lightbulb in the status bar, which will generate the file when clicked on. Unfortunately, I cannot see it and I am pretty sure that it should be showing, considering there is no jsconfig.json file in the 'myExpressApp' folder. Please see the screenshot...

Screenshot of problem

like image 491
user3599231 Avatar asked Jul 05 '26 18:07

user3599231


2 Answers

If you are on a Visual Studio Code Insiders build, with recent versions of Visual Studio Code, if you are only using JavaScript, a jsconfig.json file is no longer required. If none is provided, the root directory will be treated as an implicit JavaScript project.

If you are working with TypeScript, you still need a tsconfig.json file. See Aurora0001's answer for creating this.

I'll update the Visual Studio Code documentation/tutorial to reflect this change.

like image 64
Matt Bierner Avatar answered Jul 07 '26 09:07

Matt Bierner


It seems odd that the lightbulb doesn't appear as expected, but you can still generate a jsconfig.json yourself. If you're planning to use TypeScript, you can just run this in your terminal (in the project directory):

tsc --init

This will create a tsconfig.json file ready for you (you'll need to then add "allowJs": true in that file, because that makes it equivalent to jsconfig.json).

You could also just click 'New File', copy in the contents from the tutorial and save. There shouldn't be any detrimental effect to your project by not clicking the lightbulb to do it.

like image 22
Aurora0001 Avatar answered Jul 07 '26 09:07

Aurora0001