In VSCode autoimport works for recently opened files only

Viewed 21

I work with Javascript/React. When I try to type a name of module, exported from another file, VSCode doesn't advise me the module, but if I open the file with imported module, VSCode begins to autoimport it well. Sometimes it's require to resave file. I have the same problem with automatically changing imports when moving file. It have the same solution. Does anybody know if there is any buffer/indexation for files in VSCode or something alike?

1 Answers

I found the solution. You should create jsconfig.json in your project folder and add the next code there (it was enough for me):

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6"
    },
    "exclude": ["node_modules"]
}

Related