-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
82 lines (74 loc) · 1.69 KB
/
vite.config.ts
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
78
79
80
81
82
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { VitePWA } from 'vite-plugin-pwa';
import fs from 'fs';
export default defineConfig({
root: __dirname,
cacheDir: './node_modules/.vite/.',
base: process.env.NODE_ENV === 'production' ? '/addons/mui/' : '/',
server: {
port: 4200,
host: 'localhost',
},
preview: {
port: 4300,
host: 'localhost',
},
plugins: [
react(),
nxViteTsPaths(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'ccu-addon-mui',
short_name: 'ccu-addon-mui',
icons: [
{
src: 'android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png',
}
],
},
}),
{
name: 'load-tcl',
transform(src, id) {
if (id.endsWith('.tcl')) {
return `export default ${JSON.stringify(src)}`;
}
},
load(id) {
if (id.endsWith('.tcl')) {
return fs.readFileSync(id, 'utf-8');
}
},
},
],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
build: {
outDir: './dist/.',
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
},
test: {
globals: true,
cache: {
dir: './node_modules/.vitest',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: './coverage/.',
provider: 'v8',
},
},
});