-
Notifications
You must be signed in to change notification settings - Fork 20
/
vite.config.js
44 lines (42 loc) · 1001 Bytes
/
vite.config.js
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import fs from 'fs';
export default defineConfig(({ mode }) => {
let configFile = 'config.json';
if ( process.env.WPCOM_BUILD ) {
configFile = 'config.wpcom.json';
}
const configPath = path.resolve(__dirname, 'src', configFile);
const config = fs.readFileSync(configPath, 'utf-8');
return {
resolve: {
alias: {
'util': 'util',
}
},
server: {
port: 3000,
},
build: {
outDir: 'build',
assetsDir: 'static',
},
plugins: [react()],
define: {
'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG),
'__APP_CONFIG__': JSON.stringify(config),
},
test: {
globals: true,
environment: 'jsdom',
css: true,
reporters: ['verbose'],
coverage: {
reporter: ['text', 'json', 'html'],
include: ['src/**/*'],
exclude: [],
}
}
};
});