'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



Solution 1:[1]

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.

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Mortensen
Solution 2 Peter Mortensen