-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
58 lines (57 loc) · 2.08 KB
/
vite.config.ts
File metadata and controls
58 lines (57 loc) · 2.08 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
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
/* Vite config — React + Tailwind CSS v4 + Vitest
* base: '/' — web/Netlify build uses root-relative paths.
* Electron uses electron.vite.config.ts (base: './') independently.
*
* Note: sw.js cache-busting is handled by scripts/inject-sw-version.mjs
* via the "postbuild" npm script — Vite 8 (Rolldown) plugin hooks fire
* before Vite copies public/ assets, making in-plugin injection unreliable. */
export default defineConfig({
base: '/',
plugins: [
react(),
tailwindcss(),
],
resolve: {
/* Force single instances of audio packages to avoid dead audio chains
* and duplicate @strudel/core state (the double-instance MIDI bug) */
dedupe: ['superdough', '@strudel/core', '@strudel/web', '@strudel/webaudio', '@strudel/midi', '@strudel/draw', '@strudel/codemirror'],
},
optimizeDeps: {
/* Pre-bundle all strudel packages together */
include: [
'@strudel/core',
'@strudel/web',
'@strudel/webaudio',
'@strudel/mini',
'@strudel/tonal',
'@strudel/transpiler',
'@strudel/midi',
'@strudel/draw',
'@strudel/codemirror',
'@strudel/xen',
'superdough',
],
},
build: {
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes('node_modules/@strudel') || id.includes('node_modules/superdough')) return 'vendor-strudel'
if (id.includes('node_modules/react-dom') || id.includes('node_modules/react/') || id.includes('node_modules/react-router') || id.includes('node_modules/zustand')) return 'vendor-react'
if (id.includes('node_modules/@codemirror')) return 'vendor-codemirror'
if (id.includes('node_modules/@xyflow')) return 'vendor-reactflow'
if (id.includes('node_modules/i18next') || id.includes('node_modules/react-i18next')) return 'vendor-i18n'
},
},
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/test-setup.ts',
},
})