Answer the question
In order to leave comments, you need to log in
How to add context hints for a module with a "module" path in VS Code?
Webpack understands absolute, relative and "modular" paths. For example:
'../../scripts/script.ts' - relative
'H:/first-task/src/scripts/script.ts' - absolute
'scripts/script' - modular.
With the help of the resolver and the modules, extensions setting, webpack can find modules along the module path.
And VS Code can't.
Therefore, for absolute and relative paths, it gives hints (about what exactly is imported, which fields, functions, etc.), but not for modular ones.
Is there a way to teach VS Code to understand such paths for issuing contextual hints?
Answer the question
In order to leave comments, you need to log in
If I understood everything correctly, then you need to place the jsconfig.json file in the root of the project, (see https://code.visualstudio.com/docs/languages/jsconfig ) in which you write something like:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
// пример других алиасов (копия webpack aliases):
"src/*": [
"src/*"
],
"scripts/*": [
"scripts/*"
],
"app/*": [
"*"
],
"components/*": [
"src/components/*"
],
"layouts/*": [
"src/layouts/*"
],
"pages/*": [
"src/pages/*"
],
"assets/*": [
"src/assets/*"
],
"boot/*": [
"src/boot/*"
]
}
},
"exclude": [
"dist",
"node_modules",
//... другие не нужные пути
]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question