forked from vercel/vercel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mts
More file actions
25 lines (23 loc) · 835 Bytes
/
Copy pathvitest.config.mts
File metadata and controls
25 lines (23 loc) · 835 Bytes
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
import { mergeConfig } from 'vite';
import rootConfig from '../../vitest.config.mts';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { generateConfigValidator } from './scripts/precompile-config-validator.mjs';
// Get peer dependencies to externalize them (they may not be installed in CI)
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
const peerDeps = Object.keys(pkg.peerDependencies || {});
export default mergeConfig(rootConfig, {
// Exercise the same precompiled validator that the production build ships.
resolve: {
alias: {
'./config-validator': await generateConfigValidator(),
},
},
test: {
setupFiles: ['./vitest.setup.mts'],
},
ssr: {
// Externalize peer dependencies so Vite doesn't try to resolve them
external: peerDeps,
},
});