diff --git a/app/game-frontend/src/config/viteEnv.ts b/app/game-frontend/src/config/viteEnv.ts new file mode 100644 index 00000000..1e3b33bc --- /dev/null +++ b/app/game-frontend/src/config/viteEnv.ts @@ -0,0 +1,7 @@ +export const mergeViteEnv = ( + fileEnv: Record, + runtimeEnv: NodeJS.ProcessEnv +): Record => ({ + ...fileEnv, + ...runtimeEnv, +}); diff --git a/app/game-frontend/test/viteConfig.test.ts b/app/game-frontend/test/viteConfig.test.ts index 01a8abe6..6ebe9cf7 100644 --- a/app/game-frontend/test/viteConfig.test.ts +++ b/app/game-frontend/test/viteConfig.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; -import { mergeViteEnv } from '../vite.config.ts'; +import { mergeViteEnv } from '../src/config/viteEnv.ts'; void describe('game frontend Vite config', () => { void it('prefers managed runtime values over values loaded from env files', () => { diff --git a/app/game-frontend/vite.config.ts b/app/game-frontend/vite.config.ts index 96f42431..2930af53 100644 --- a/app/game-frontend/vite.config.ts +++ b/app/game-frontend/vite.config.ts @@ -2,6 +2,7 @@ import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; import tailwindcss from '@tailwindcss/vite'; import path from 'path'; +import { mergeViteEnv } from './src/config/viteEnv'; const normalizeBasePath = (value: string | undefined): string => { const pathValue = (value ?? '/').trim(); @@ -23,14 +24,6 @@ const resolvePreviewAllowedHosts = (value: string | undefined): true | string[] return hosts; }; -export const mergeViteEnv = ( - fileEnv: Record, - runtimeEnv: NodeJS.ProcessEnv -): Record => ({ - ...fileEnv, - ...runtimeEnv, -}); - // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { const env = mergeViteEnv(loadEnv(mode, process.cwd(), ''), process.env);