Vite + React + Typescript + Eslint + Airbnb eslint rules + Airbnb Typescript rules + Prettier + env variable import + Absolute Import Path
!yes, tons of setup and config files.
- You need to add type in env.d.ts like "readonly VITE_ANYTHING: string"
- variables MUST start with VITE_
- usage of env variable in your app, no need to import, just use it as a global variable: console.log(import.meta.env.VITE_API_URL)
- import App from "~/components". ~/ is the absoulte path, equal to ./src