-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
38 lines (36 loc) · 1.45 KB
/
vite.config.ts
File metadata and controls
38 lines (36 loc) · 1.45 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// Use env-driven base for flexible deployment to different paths
// dev default: /
// deploy build: VITE_APP_BASE_PATH=/xm-player/ npm run build
const base = process.env.VITE_APP_BASE_PATH || '/'
return {
base,
plugins: [react()],
server: {
// The CodeQL scanner leaves behind a self-referential symlink
// (_codeql_detected_source_root → .) which causes Vite's chokidar FSWatcher
// to recurse infinitely and crash with ELOOP. Turning off symlink-following
// and adding an explicit ignore pattern both guard against this.
watch: {
followSymlinks: false,
ignored: ['**/_codeql_detected_source_root**', '**/node_modules/**'],
},
headers: {
// Required for SharedArrayBuffer / Atomics (Emscripten WASM Workers)
'Cross-Origin-Opener-Policy': 'same-origin',
// 'credentialless' still unlocks SharedArrayBuffer but lets cross-origin
// resources (e.g. the CDN-hosted libopenmpt) load without a
// Cross-Origin-Resource-Policy header. 'require-corp' would block them.
'Cross-Origin-Embedder-Policy': 'credentialless',
},
},
optimizeDeps: {
// Don't pre-bundle the Emscripten-generated glue code
exclude: ['openmpt-native'],
},
assetsInclude: ['**/*.wasm'],
}
})