Is my jsconfig.json not working in Visual Studio Code?
javascript, visual-studio-code
Solution
In my project i was using jsconfig.json file for accesss the file imports directly from the ./src directory from wherever i am trying to import.
My jsconfig.json looks like:
{
"compilerOptions": {
"baseUrl": "./src"
},
"include": [
"src"
]
}
include:
If no include attribute is present, then this defaults to including all files in the containing directory and subdirectories. When a include attribute is specified, only those files are included
baseUrl:
This gives the base directory for the file import path
this is my project structure where i have used jsconfig.json
so if i need to import a function from `src/util/auth_util.js` inside `src/component/Login/index.js`
inside src/component/Login/index.js
src/component/Login/index.js :
`import { userLogin } from 'util/auth_util.js'`
import statement if jsconfig.json as mentioned above not used
src/component/Login/index.js :
`import { userLogin } from '../../util/auth_util.js'`
Problem
I have added a `jsconfig.json` in the root of my javascript project to try and exclude some build files as well as set some path mappings but nothing seems to happen. Part of the problem is that I'm not sure what the expected outcome is when using a `jsconfig.json`, I've read the documentation for it but it does not demonstrate any of the results. Can someone provide me with a small and working `jsconfig.json` with a description of what it actually does? So that I can use it to verify that it actually works in my project as well. Or, does someone know of a way to verify that a `jsconfig.json` is working/picked up by VS Code?