-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
71 lines (60 loc) · 2.09 KB
/
vite.config.ts
File metadata and controls
71 lines (60 loc) · 2.09 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
import { resolve } from 'node:path'
import swcPlugin from '@vitejs/plugin-react-swc'
import type { ConfigEnv } from 'vite'
import { defineConfig } from 'vite'
import glsl from 'vite-plugin-glsl'
// Import our custom plugins from the dev package
import {
getEffectBuildConfig,
lightscriptDecoratorsPlugin,
signalRGBPlugin,
startupLogoPlugin,
} from './packages/dev/plugins'
export default defineConfig(({ command }: ConfigEnv) => {
const isDevelopment = command === 'serve'
return {
// Build configuration specifically for effects
build: getEffectBuildConfig(),
// Enhance development experience
define: {
...(isDevelopment && {
__DEV__: true,
__EFFECT_ID__: JSON.stringify(process.env.EFFECT || 'default'),
}),
},
plugins: [
// React SWC with Preact compatibility - enabling decorator support
swcPlugin({
tsDecorators: true,
}),
// SignalRGB HTML generation
signalRGBPlugin(),
// GLSL shader support
glsl(),
// Only add lightscript plugins for development mode
...(isDevelopment ? [lightscriptDecoratorsPlugin(), startupLogoPlugin()] : []),
],
resolve: {
alias: {
// Package aliases - resolve to local source during development
'@lightscript/core': resolve(__dirname, 'packages/core/src'),
'@lightscript/dev': resolve(__dirname, 'packages/dev/src'),
// Preact compatibility
react: 'preact/compat',
'react-dom': 'preact/compat',
},
},
server: {
hmr: {
// Enable fast refresh for shaders and effects
overlay: true,
},
open: true,
optimizeDeps: {
exclude: ['@vite/client', '@vite/env'],
include: ['preact', 'preact/compat', 'three', 'reflect-metadata'],
},
port: 4096,
},
}
})