-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathvite.config.ts
More file actions
78 lines (76 loc) · 1.9 KB
/
vite.config.ts
File metadata and controls
78 lines (76 loc) · 1.9 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
78
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgr from 'vite-plugin-svgr';
// import { VitePWA } from 'vite-plugin-pwa';
import tailwindcss from '@tailwindcss/vite';
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
// PWA is intentionally disabled.
//
// Why:
// - Historically, SW/PWA caching can make it hard for users to pick up updates.
// - This project is typically used as a dashboard where "always fresh" is preferred.
//
// How to re-enable:
// - Uncomment the `vite-plugin-pwa` import above
// - Uncomment the `VitePWA({ ... })` plugin block below
// - Restore the `<link rel="manifest" ...>` in `index.html`
// - Then rebuild.
base: './', // needed to work in subdirectories
build: {
outDir: 'build',
},
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
plugins: [
react({
// Enable JSX in .js files
include: /\.(jsx|js|tsx|ts)$/,
}),
viteTsconfigPaths(),
tailwindcss(),
svgr({
include: '**/*.svg?react',
}),
// PWA plugin (disabled)
// VitePWA({
// injectRegister: 'auto',
// }),
],
resolve: {
// alias. These also need to be set up in tsconfig.json
alias: {
'~': path.resolve(__dirname, './src'),
'atoms': path.resolve(__dirname, 'src/atoms'),
'components': path.resolve(__dirname, 'src/components'),
'helpers': path.resolve(__dirname, 'src/helpers'),
'types': path.resolve(__dirname, 'src/types'),
'widgets': path.resolve(__dirname, 'src/widgets'),
},
},
server: {
open: false, // BROWSER=false
port: 3015,
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/setupTests.ts'],
coverage: {
reporter: ['text', 'html'],
exclude: [
'node_modules/',
'src/setupTests.ts',
],
},
},
});