Vite Vue3 place multiple ".env" files in a folder

Viewed 278

I have 11 .env files for testing and other reasons.

Is there way I can put them in a folder and use them from there?

Such as:

  • /root
    • env-container
      • .env-test1
      • .env-test2
      • .env-test3
1 Answers

You can configure the location of the .env files with the envDir config:

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  envDir: './root/env-container',
})
Related