mirror of
https://github.com/Snigdha-OS/Snigdha-OS.github.io.git
synced 2025-09-06 04:35:18 +02:00
🧹 chore: upgrade and proecess files has been extended
This commit is contained in:
@@ -37,10 +37,12 @@
|
|||||||
"gh-pages": "^6.2.0",
|
"gh-pages": "^6.2.0",
|
||||||
"globals": "^15.14.0",
|
"globals": "^15.14.0",
|
||||||
"postcss": "^8.4.49",
|
"postcss": "^8.4.49",
|
||||||
|
"postcss-preset-env": "^10.1.3",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
"typescript-eslint": "^8.18.2",
|
"typescript-eslint": "^8.18.2",
|
||||||
"vite": "^5.4.11",
|
"vite": "^5.4.11",
|
||||||
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-sitemap": "^0.7.1"
|
"vite-plugin-sitemap": "^0.7.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
947
pnpm-lock.yaml
generated
947
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -2,37 +2,89 @@ import { defineConfig } from 'vite';
|
|||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import ViteSitemap from 'vite-plugin-sitemap';
|
import ViteSitemap from 'vite-plugin-sitemap';
|
||||||
|
import ViteCompression from 'vite-plugin-compression'; // For file compression in production
|
||||||
|
import postcssPresetEnv from 'postcss-preset-env'; // For enabling modern PostCSS features
|
||||||
|
|
||||||
|
// Define the base path based on the deployment environment (GitHub Pages or main domain)
|
||||||
|
const isGitHubPages = process.env.VITE_DEPLOY_ENV === 'gh-pages';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
// Base path setting for GitHub Pages and main domain
|
||||||
|
// Use '/' for both GitHub Pages and the main domain (adjust as needed)
|
||||||
|
base: isGitHubPages ? '/' : '/',
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(), // Vite plugin for React support
|
||||||
|
|
||||||
|
// Sitemap plugin to generate a sitemap.xml for SEO purposes
|
||||||
ViteSitemap({
|
ViteSitemap({
|
||||||
hostname: 'https://www.snigdhaos.org',
|
hostname: isGitHubPages ? 'https://Snigdha-OS.github.io/' : 'https://www.snigdhaos.org', // Dynamic hostname based on deployment
|
||||||
outDir: './dist',
|
outDir: './dist', // Directory to output the sitemap
|
||||||
changefreq: 'daily',
|
changefreq: 'daily', // Frequency of content updates
|
||||||
priority: 0.7,
|
priority: 0.7, // Priority of the pages in the sitemap
|
||||||
// lastmod: true,
|
// lastmod: true, // Optional: Use last modification date for each URL (uncomment if needed)
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Gzip compression for production build to reduce file sizes
|
||||||
|
ViteCompression({
|
||||||
|
algorithm: 'gzip', // Compression algorithm
|
||||||
|
threshold: 10240, // Only compress files larger than 10KB
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
|
// Alias for easier imports from the 'src' directory
|
||||||
alias: {
|
alias: {
|
||||||
'@': resolve(__dirname, './src'),
|
'@': resolve(__dirname, './src'), // '@' is a shortcut for the 'src' folder
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
entryFileNames: 'main.js',
|
// Entry file for the build (e.g., script.js instead of main.js)
|
||||||
|
entryFileNames: 'script.js',
|
||||||
|
|
||||||
|
// Customize asset file names (e.g., CSS and other assets)
|
||||||
assetFileNames: ({ name }) => {
|
assetFileNames: ({ name }) => {
|
||||||
if (name && name.endsWith('.css')) {
|
if (name && name.endsWith('.css')) {
|
||||||
return 'style.css';
|
return 'style.css'; // All CSS files will be named 'style.css'
|
||||||
}
|
}
|
||||||
return 'assets/[name]-[hash][extname]';
|
return 'assets/[name]-[hash][extname]'; // For other assets, use hashed filenames
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
target: 'esnext', // Set the target to 'esnext' for modern JavaScript (ES modules)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Exclude specific dependencies from being bundled by Vite
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
exclude: ['lucide-react'],
|
exclude: ['lucide-react'], // Prevent bundling of 'lucide-react'
|
||||||
|
},
|
||||||
|
|
||||||
|
css: {
|
||||||
|
postcss: {
|
||||||
|
plugins: [
|
||||||
|
postcssPresetEnv({
|
||||||
|
stage: 2, // Enable PostCSS features up to stage 2
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// Configuration for Vite development server
|
||||||
|
server: {
|
||||||
|
open: true, // Automatically open the browser when starting the dev server
|
||||||
|
proxy: {
|
||||||
|
'/api': 'http://localhost:5000', // Example proxy setup for API requests during development
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// Extend configuration with environment variables (useful for flexibility)
|
||||||
|
define: {
|
||||||
|
'process.env': {
|
||||||
|
// Provide a default API URL, which can be overridden by environment variables
|
||||||
|
API_URL: process.env.VITE_API_URL || 'https://api.snigdhaos.org',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user