-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
46 lines (45 loc) · 1.3 KB
/
vite.config.js
File metadata and controls
46 lines (45 loc) · 1.3 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
// Use relative paths for Electron production builds
base: process.env.ELECTRON === 'true' ? './' : '/',
plugins: [react()],
server: {
watch: {
// Ignore non-code files to prevent auto-reload during analysis
// BUT allow .tsx/.jsx so Vite can transform them for dynamic imports
ignored: [
'**/src/generated/**/*.html',
'**/src/generated/**/*.png',
'**/src/generated/**/*.jpg',
'**/src/generated/**/*.svg',
'**/src/generated/**/*.json',
'**/src/generated/**/*.xml',
'**/src/generated/**/*.md',
]
}
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
rollupOptions: {
external: (id) => {
// Exclude src/generated/ files EXCEPT puck/ directories
if (id.includes('/src/generated/')) {
// Allow ALL files in puck/ directories (puck.config.tsx + components it imports)
if (id.includes('/puck/')) {
return false // Include in bundle
}
// Exclude everything else in src/generated/
return true
}
return false
}
}
}
})