Vite Errors, such as Cannot find type definition file for ‘vite/client’

In the context of Sanity CMS, this only applies to the studio or cms folder.

You’ll need to create a vite.end.ts in the root of your studio folder with the following code:

/// <reference types="vite/client" />

interface ImportMetaEnv {
  readonly VITE_APP_TITLE: string;
  // more env variables...
}

interface ImportMeta {
  readonly env: ImportMetaEnv;
}

See full instructions here:

https://vitejs.dev/guide/env-and-mode#intellisense-for-typescript