Skip to content

Commit

Permalink
Ensure real env variables are seen by vite
Browse files Browse the repository at this point in the history
  • Loading branch information
komali2 committed Mar 19, 2024
1 parent 8403b8b commit 948fec6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import nightwatchPlugin from 'vite-plugin-nightwatch'

const viteEnv = {}
Object.keys(process.env).forEach((key) => {
if (key.startsWith(`VITE_`)) {
viteEnv[`import.meta.env.${key}`] = process.env[key]
}
})
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
nightwatchPlugin(),
],
define: viteEnv,
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
Expand Down

0 comments on commit 948fec6

Please sign in to comment.