mirror of
https://github.com/Snigdha-OS/Snigdha-OS.github.io.git
synced 2025-09-05 20:26:43 +02:00
🧹 chore: optimize vite config
This commit is contained in:
@@ -3,39 +3,59 @@ import react from '@vitejs/plugin-react';
|
||||
import { resolve } from 'path';
|
||||
import ViteSitemap from 'vite-plugin-sitemap';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react(),
|
||||
ViteSitemap({
|
||||
hostname: 'https://www.snigdhaos.org',
|
||||
outDir: './dist',
|
||||
changefreq: 'daily',
|
||||
priority: 0.7,
|
||||
// lastmod: true,
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, './src'),
|
||||
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'),
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: 'script.js',
|
||||
assetFileNames: ({ name }) => {
|
||||
if (name && name.endsWith('.css')) {
|
||||
return 'style.css';
|
||||
}
|
||||
return 'assets/[name]-[hash][extname]';
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
additionalData: `@import "@/styles/global.scss";`, // Import global SCSS
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ['lucide-react'],
|
||||
},
|
||||
server: {
|
||||
open: true, // Automatically open the browser when running the development server
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: 'script.js',
|
||||
chunkFileNames: 'chunk-[name]-[hash].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
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user