Home

Published

- 1 min read

Property `env` does not exist on type `ImportMeta`

img of Property `env` does not exist on type `ImportMeta`

The solution for this is noted below

Property env does not exist on type ImportMeta

Solution

   // Create a new file in your root with the name "vite-env.d.ts"
// if you're using vite input the name "VITE_" in front of your variables
// for next.js use "NEXT_"
interface ImportMetaEnv {
	VITE_API_URL_EXAMPLE: string
	VITE_SECRET_KEY_EXAMPLE: string
	// Add other environment variables here...
}

interface ImportMeta {
	env: ImportMetaEnv
}

Try other methods by searching on the site. That is if this doesn’t work