Files
Genarrative/vite.config.ts
高物 bd9fdcbe31
Some checks failed
CI / verify (push) Has been cancelled
Implement scene-based chapter quest progression
2026-04-08 11:58:47 +08:00

53 lines
1.4 KiB
TypeScript

import path from 'node:path';
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import {defineConfig, loadEnv} from 'vite';
import {createLocalApiPlugins} from './scripts/dev-server/localApiPlugins';
export default defineConfig(({mode}) => {
const env = loadEnv(mode, __dirname, '');
const ignoredWatchGlobs = [
'**/dist/**',
'**/dist_check/**',
'**/dist_check_final/**',
'**/dist_check_monster_position/**',
'**/temp*build*/**',
];
return {
root: __dirname,
envDir: __dirname,
plugins: [
react(),
tailwindcss(),
...createLocalApiPlugins(__dirname, mode, env),
],
define: {
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
},
},
optimizeDeps: {
// Only crawl the real app entry so temporary build folders do not get
// treated as extra HTML entrypoints during dependency scanning.
entries: ['index.html'],
},
build: {
chunkSizeWarningLimit: 750,
},
server: {
// HMR is disabled in AI Studio via DISABLE_HMR env var.
// Do not modify; file watching is disabled to prevent flickering during agent edits.
hmr: process.env.DISABLE_HMR !== 'true',
watch: {
ignored: ignoredWatchGlobs,
},
},
};
});