#env not found in import.meta

1 messages · Page 1 of 1 (latest)

shy cliff
#

Trying to get things ready for production.
The following line:
const res: Response = await fetch(import.meta.env.VITE_BACKEND_FQDN + admin/unban/${id}, {

Says that under import.meta there is no object env, and my LSP server says that only url is there.

I've read some threads of StackOverflow and tried different solutions (like https://github.com/vitejs/vite/issues/9539) without success.

Any idea?

GitHub

Next generation frontend tooling. It's fast! Contribute to vitejs/vite development by creating an account on GitHub.

shy cliff
#

For anyone looking in the future: ignore your LSP. The variables starting with VITE_ work as long as you have the mentioned .d.ts file or the types object under your tsconfig file