-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvite.config.ts
47 lines (45 loc) · 1.15 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
import react from '@vitejs/plugin-react';
import tailwindcss from 'tailwindcss';
import {defineConfig, loadEnv} from 'vite';
import {VitePWA} from 'vite-plugin-pwa';
import viteTsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig(({mode}) => {
// Currently our configuration only reads ENV variables which
// are prefixed with 'VITE_' (default, for security reasons).
const env = loadEnv(mode, process.cwd());
return {
base: '/',
plugins: [
react(),
viteTsconfigPaths(),
VitePWA({
srcDir: 'src',
filename: 'service-worker.ts',
// We generate our own manifest.json from the public folder
manifest: false,
injectRegister: null,
workbox: {
globPatterns: ['**/*.{js,css,html,json,png,mp3,ttf}'],
},
}),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: './vitest.setup.ts',
},
server: {
open: true,
port: parseInt(env.VITE_PORT || '3000', 10),
},
build: {
cssCodeSplit: false,
minify: true,
},
css: {
postcss: {
plugins: [tailwindcss()],
},
},
};
});