reactjsvisual-studio-codenext.jsauto-import

VSCode autoimport not working after using absolute imports in NextJS


my VSCode auto import(using control + space) is not working after I created a jsconfig.json file in my NextJS project.

This is my json:

{
  "compilerOptions": {
    "baseUrl": "."
  },
  "include": ["."]
}

I'm using next 10.2.3 and vscode 1.57.1. If I remove the jsconfig.json file, auto import works just fine..

Someone knows why?


Solution

  • I think you need to add extensions as well. Here's how my app is using it, and I'm getting auto import suggestions correctly.

    "baseUrl": ".",
    "include": [
        "next-env.d.ts",
        "**/*.ts",
        "**/*.tsx"
      ],