Visual Studio Code's jsconfig.json
Today let’s talk about some tips for configuring Visual Studio Code’s jsconfig.json.
What is jsconfig.json?
If your project has a jsconfig.json file, its configuration can provide personalized support for all JS code in the file’s directory.
Tip: If you’ve just added this file to your project, remember to restart VSCode.
Examples
exclude Property
When VSCode scans project code, if it encounters node_modules, it becomes very slow.
If you want to improve editor performance, you should exclude this folder.
{
"exclude": [
"node_modules"
]
}
include Property
There’s also the corresponding include property.
{
"include": [
"src/**/*"
]
}
Webpack Aliases Support
If we configure path aliases in our webpack config, you might notice that VSCode can no longer jump to files for imports using alias paths. So we also need jsconfig.json support.
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@component": ["./src/component"]
}
}
}
The configuration of jsconfig.json is a subset of tsconfig.json.
I’ll talk about tsconfig.json some other time.
That’s all for today~