forked from 000masa000/hexatone
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
77 lines (68 loc) · 1.97 KB
/
vite.config.js
File metadata and controls
77 lines (68 loc) · 1.97 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
72
73
74
75
76
77
import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';
import svgr from 'vite-plugin-svgr';
import path from 'path';
export default defineConfig({
plugins: [
preact({
babel: {
parserOpts: {
plugins: ['jsx'],
},
},
}),
svgr({
svgrOptions: {
svgoConfig: {
plugins: [
{ name: 'mergePaths', active: false },
{ name: 'prefixIds', active: false },
{ name: 'cleanupIDs', active: false },
],
},
},
})
],
optimizeDeps: {
esbuildOptions: {
loader: { '.js': 'jsx' },
},
},
resolve: {
alias: {
scales: path.resolve(__dirname, 'scales'),
'react': 'preact/compat',
'react-dom/test-utils':'preact/test-utils',
'react-dom': 'preact/compat',
},
},
// Base path: '/' for production (hexatone.plainsound.org), '/hexatone/' for
// GitHub Pages preview (plainsound.github.io/hexatone). Set VITE_BASE_PATH in CI.
base: process.env.VITE_BASE_PATH || '/',
build: {
outDir: 'build',
sourcemap: true,
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
retune: path.resolve(__dirname, 'retune.html'),
},
},
},
server: {
host: '0.0.0.0',
},
// ── Vitest ──────────────────────────────────────────────────────────────────
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.js'],
include: ['src/**/*.test.{js,jsx}'],
// Stub static assets — same role as the old Jest moduleNameMapper
moduleNameMapper: {
'\\.(mp3|wav|ogg|scl|ascl|svg|png|jpg|jpeg|gif|woff|woff2|ttf|eot)(\\?.*)?$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
},
},
});