-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.shared.ts
More file actions
35 lines (33 loc) · 848 Bytes
/
vite.config.shared.ts
File metadata and controls
35 lines (33 loc) · 848 Bytes
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
import { UserConfigExport } from 'vite'
/**
* Shared Vite configuration options for DevTeam6 projects
*/
export interface SharedViteConfig {
/** Base path for deployment */
base?: string
/** Server port */
port?: number
/** Whether to auto-open browser */
open?: boolean
/** Output directory */
outDir?: string
/** Enable source maps */
sourcemap?: boolean
}
/**
* Create a common Vite build configuration
*/
export function createBuildConfig(options: SharedViteConfig = {}): UserConfigExport {
return {
base: options.base || '/',
build: {
outDir: options.outDir || 'dist',
sourcemap: options.sourcemap !== false,
},
server: {
port: options.port || 3000,
host: true,
...(options.open !== undefined && { open: options.open }),
},
}
}