-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
61 lines (59 loc) · 1.56 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import ViteSitemap from 'vite-plugin-sitemap';
export default defineConfig(({ mode }) => {
const isProduction = mode === 'production';
return {
plugins: [
react(),
ViteSitemap({
hostname: process.env.VITE_SITE_URL || 'https://www.snigdhaos.org',
outDir: './dist',
changefreq: 'daily',
priority: 0.7,
}),
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/global.scss";`, // Import global SCSS
},
},
},
build: {
rollupOptions: {
output: {
entryFileNames: 'script.js',
chunkFileNames: '[name].js',
assetFileNames: ({ name }) => {
if (name && name.endsWith('.css')) {
return 'style.css';
}
return 'assets/[name]-[hash][extname]';
},
},
},
terserOptions: {
compress: {
drop_console: isProduction, // Remove console logs in production
drop_debugger: isProduction, // Remove debugger in production
},
},
},
optimizeDeps: {
exclude: ['lucide-react'],
},
server: {
open: true,
port: 5173, // Default port
strictPort: false, // Allow using a different port if 5173 is taken
},
envDir: './env', // Define directory for environment variables
};
});