vite-plugin-environment icon indicating copy to clipboard operation
vite-plugin-environment copied to clipboard

Issue with Vite v5

Open SebastienGllmt opened this issue 1 year ago • 3 comments

I found that this plugin no longer works in Vite v5. Notably, according to their docs about how they changed define, esbuild is now used to manage environment variables during build this.

Notably, this seams to mean

export default defineConfig({
  plugins: [EnvironmentPlugin('all')],

No longer works, and instead I had to add to esbuildOptions instead

optimizeDeps: {
    esbuildOptions: {
      define: {
        // add envs here (can't use vite-plugin-environment for this)
      },
   }
}

SebastienGllmt avatar Dec 08 '23 14:12 SebastienGllmt