-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
62 lines (55 loc) · 1.55 KB
/
vite.config.js
File metadata and controls
62 lines (55 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { defineConfig, loadEnv } from 'vite';
import configPlugin from './vite-plugin-config.js';
import htmlConfigPlugin from './vite-plugin-html-config.js';
export default defineConfig(({ command, mode }) => {
// Load environment variables based on mode
const env = loadEnv(mode, process.cwd(), '');
return {
// Register custom plugins for configuration injection
plugins: [
configPlugin(env),
htmlConfigPlugin(env),
],
// Base public path - adjust if deploying to a subdirectory
base: '/',
// Server configuration
server: {
port: 3000,
open: true, // Auto-open browser on server start
},
// Build configuration
build: {
outDir: 'dist',
assetsDir: 'assets',
// Generate sourcemaps for debugging production builds
sourcemap: false,
// Optimize chunk size
rollupOptions: {
output: {
manualChunks: {
// Separate game logic into its own chunk for better caching
'game-core': [
'./js/board.js',
'./js/light-cycle.js',
'./js/collision-grid.js',
],
'game-ai': [
'./js/enhanced-ai.js',
'./js/ai-integration.js',
],
'game-ui': [
'./js/game-controller.js',
'./js/canvas-renderer.js',
],
},
},
},
},
// Asset handling
assetsInclude: ['**/*.png', '**/*.jpg', '**/*.svg'],
// Optimizations
optimizeDeps: {
include: [],
},
};
});