-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
42 lines (38 loc) · 1.11 KB
/
vite.config.ts
File metadata and controls
42 lines (38 loc) · 1.11 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
import { defineConfig, loadEnv } from 'vite';
import { resolve } from 'path';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
// Check if building for demo or library
const isDemo = mode === 'demo' || env.BUILD_DEMO === 'true';
if (isDemo) {
// Demo build - outputs a full website for testing
return {
build: {
outDir: 'dist-demo',
},
define: {
__CONVEX_URL__: JSON.stringify(env.CONVEX_URL || ''),
},
};
}
// Library build - outputs tour.js for embedding
return {
build: {
lib: {
entry: resolve(__dirname, 'src/main.ts'),
name: 'WalkmanJS',
fileName: 'tour',
formats: ['iife'],
},
rollupOptions: {
output: {
inlineDynamicImports: true,
},
},
minify: 'esbuild',
},
define: {
__CONVEX_URL__: JSON.stringify(env.CONVEX_URL || ''),
},
};
});