-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathvite.config.js
More file actions
53 lines (51 loc) · 1.61 KB
/
Copy pathvite.config.js
File metadata and controls
53 lines (51 loc) · 1.61 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { execSync } from 'node:child_process';
// https://vitejs.dev/config/
export default defineConfig({
base: '/',
build: {
sourcemap: true,
},
server: {
host: '127.0.0.1',
port: 3000,
},
resolve: {
alias: [
// React 17 ships no "exports" map, so bare "react/jsx-runtime" fails
// strict ESM resolution for packages (e.g. @floating-ui/react) that
// use the automatic JSX runtime. Exact-match only, so it can't collide
// with unrelated subpaths the way a plain-object alias would.
{ find: /^react\/jsx-runtime$/, replacement: 'react/jsx-runtime.js' },
{ find: /^react\/jsx-dev-runtime$/, replacement: 'react/jsx-dev-runtime.js' },
],
},
plugins: [react()],
define: {
__GIT_SHA__: JSON.stringify(execSync('git rev-parse HEAD').toString()),
__GIT_TAG__: JSON.stringify(execSync('git describe --tags --exact-match 2>/dev/null || true').toString()),
},
test: {
exclude: ['**/playwright/**', '**/node_modules/**', '**/dist/**'],
// @floating-ui/react is otherwise externalized and imported by Node's
// native ESM resolver, which never applies the resolve.alias above.
// Force it through Vite's transform pipeline so the alias takes effect.
server: {
deps: {
inline: [/@floating-ui\//],
},
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'**/playwright/**',
'**/node_modules/**',
'**/dist/**',
'**/*.test.*',
'**/*.spec.*'
]
}
},
});