Files
core2026/app/game-frontend/vite.config.ts
T
Hide_D 161ec90bf8 feat: 전투 시뮬레이터를 브라우저 Worker로 이관
서버가 권위 환경과 반복 seed를 준비하고 공용 logic 프로세서를 브라우저와 기존 서버 fallback이 함께 사용하도록 변경한다. production Chromium에서 고정 seed와 1000회 Node 결과 동등성을 검증한다.
2026-08-17 01:45:41 +00:00

59 lines
1.6 KiB
TypeScript

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();
if (!pathValue || pathValue === '/') {
return '/';
}
return `/${pathValue.replace(/^\/+|\/+$/g, '')}/`;
};
const resolvePreviewAllowedHosts = (value: string | undefined): true | string[] => {
const normalized = value?.trim();
if (normalized === '*') {
return true;
}
const hosts = (normalized ?? 'dev-sam-e2e.hided.net')
.split(',')
.map((host) => host.trim())
.filter(Boolean);
return hosts;
};
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = mergeViteEnv(loadEnv(mode, process.cwd(), ''), process.env);
return {
base: normalizeBasePath(env.VITE_APP_BASE_PATH),
plugins: [vue(), tailwindcss()],
build: {
sourcemap: true,
},
worker: {
format: 'es',
rolldownOptions: {
output: {
codeSplitting: false,
},
},
},
resolve: {
alias: {
'@': path.resolve(import.meta.dirname, './src'),
},
},
server: {
host: '0.0.0.0',
port: 3001,
},
preview: {
host: '0.0.0.0',
allowedHosts: resolvePreviewAllowedHosts(env.VITE_PREVIEW_ALLOWED_HOSTS),
},
};
});