Repository navigation
Expand file tree
/
Copy pathvite.config.web.ts
More file actions
71 lines (69 loc) · 2.42 KB
/
Copy pathvite.config.web.ts
File metadata and controls
71 lines (69 loc) · 2.42 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
63
64
65
66
67
68
69
70
71
/**
* Standalone Vite config for web-only development.
*
* Usage:
* npx vite --config vite.config.web.ts
*
* This starts the renderer dev server on http://localhost:1212 and LAN IPs without
* launching Electron, which is useful for:
* - Headless / CI environments where Electron cannot run
* - Faster iteration on renderer-only changes
* - Web platform testing
*
* It reuses the same plugins and settings as the renderer section in
* electron.vite.config.ts to keep behavior consistent.
*/
import path from 'node:path'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { dvhToVh, injectBaseTag } from './electron.vite.config'
export default defineConfig({
root: 'src/renderer',
plugins: [
TanStackRouterVite({
target: 'react',
autoCodeSplitting: true,
routesDirectory: './src/renderer/routes',
generatedRouteTree: './src/renderer/routeTree.gen.ts',
}),
react({}),
dvhToVh(),
injectBaseTag(),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src/renderer'),
'@shared': path.resolve(__dirname, 'src/shared'),
},
},
server: {
host: process.env.DEV_HOST || '0.0.0.0',
port: Number(process.env.DEV_PORT) || 1212,
},
define: {
'process.type': '"renderer"',
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.CHATBOX_BUILD_TARGET': JSON.stringify(process.env.CHATBOX_BUILD_TARGET || 'unknown'),
'process.env.CHATBOX_BUILD_PLATFORM': JSON.stringify('web'),
'process.env.USE_LOCAL_API': JSON.stringify(process.env.USE_LOCAL_API || ''),
'process.env.USE_BETA_API': JSON.stringify(process.env.USE_BETA_API || ''),
'process.env.USE_NEWDB_API': JSON.stringify(process.env.USE_NEWDB_API || ''),
'process.env.USE_LOCAL_CHATBOX': JSON.stringify(process.env.USE_LOCAL_CHATBOX || ''),
'process.env.USE_BETA_CHATBOX': JSON.stringify(process.env.USE_BETA_CHATBOX || ''),
'process.env.CHATBOX_SKIP_GUIDE': JSON.stringify(process.env.CHATBOX_SKIP_GUIDE || ''),
'process.env.CHATBOX_START_PAGE': JSON.stringify(process.env.CHATBOX_START_PAGE || ''),
},
css: {
modules: {
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
postcss: './postcss.config.cjs',
},
optimizeDeps: {
include: ['mermaid'],
esbuildOptions: {
target: 'es2015',
},
},
})