Professional Web Developer
🕵🏻 Professional Web Developer ✍ Technical Writer • 👨💻 Making Web Development easier for beginners • ⚡ JavaScript & Node js
Markdown supported · ⌘↵ to post
process is now removed from vite also in vite config we cant access env direct, instead we have to use loadENV from vite, like below:-
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, '.', 'VITE_');
return {
base: env.VITE_BASE_PATH || "/your-repo-name",
// Other Vite configurations
};
});

Mohd Shan
process.env is removed from Vite. Now they use import.meta but it also doesn't work in a Vite config file only. In the Vite config, we have to use the loadENV method.