javascriptjsonvisual-studio-codegoogle-chrome-extension

How do I get jsconfig.json working for a chrome extension on vscode?


I just created a jsconfig.json file with the line below at the root of my project:

{"typeAcquisition": {"include": ["chrome"]}}

My intellisense for chrome api still doesnt seem to work. Does anyone know what might be the problem? Do I need to add something else to my jsconfig for vscode to be able to read it?


Solution

  • However, according to VS Code Docs, there isn't an option typeAcquisition in jsconfig.json. Only tsconfig.json supports that.


    Although you are not using TypeScript, VS Code knows tsconfig.json. Use this:

    {
      "compilerOptions": {
        "types": ["chrome"]
      }
    }
    

    Run:

    pnpm add -D @types/chrome
    

    it works