Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from = "/*"
to = "/index.html"
status = 200
# SPA fallback is handled entirely here so no additional _redirects file is required.

[functions]
node_bundler = "esbuild"
Expand All @@ -46,4 +47,30 @@
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
Referrer-Policy = "strict-origin-when-cross-origin"
Cache-Control = "no-cache, no-store, must-revalidate"
Netlify-CDN-Cache-Control = "no-cache, no-store, must-revalidate"
Pragma = "no-cache"
Expires = "0"

[[headers]]
for = "/app/*"
[headers.values]
Cache-Control = "no-cache, no-store, must-revalidate"
Netlify-CDN-Cache-Control = "no-cache, no-store, must-revalidate"
Pragma = "no-cache"
Expires = "0"

[[headers]]
for = "/index.html"
[headers.values]
Cache-Control = "no-cache, no-store, must-revalidate"
Netlify-CDN-Cache-Control = "no-cache, no-store, must-revalidate"
Pragma = "no-cache"
Expires = "0"

[[headers]]
for = "/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
Netlify-CDN-Cache-Control = "public, max-age=31536000, immutable"
32 changes: 23 additions & 9 deletions public/_headers
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
# Security headers
# Security headers and disable caching of the SPA shell
/*
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Netlify-CDN-Cache-Control: no-cache, no-store, must-revalidate
Permissions-Policy: geolocation=(), microphone=(), camera=()
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

# Ensure the app bundles are always served fresh
/app/*
Cache-Control: no-cache, no-store, must-revalidate
Netlify-CDN-Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

# Cache static assets for 1 year
/assets/*
Cache-Control: public, max-age=31536000, immutable

# Cache CSS and JS for 1 month
*.css
Cache-Control: public, max-age=2592000

*.js
Cache-Control: public, max-age=2592000
Netlify-CDN-Cache-Control: public, max-age=31536000, immutable

# Cache images for 6 months
*.png
Cache-Control: public, max-age=15552000
Netlify-CDN-Cache-Control: public, max-age=15552000

*.jpg
Cache-Control: public, max-age=15552000
Netlify-CDN-Cache-Control: public, max-age=15552000

*.jpeg
Cache-Control: public, max-age=15552000
Netlify-CDN-Cache-Control: public, max-age=15552000

*.gif
Cache-Control: public, max-age=15552000
Netlify-CDN-Cache-Control: public, max-age=15552000

*.svg
Cache-Control: public, max-age=15552000
Netlify-CDN-Cache-Control: public, max-age=15552000

*.webp
Cache-Control: public, max-age=15552000
Netlify-CDN-Cache-Control: public, max-age=15552000

# Cache fonts for 1 year
*.woff
Cache-Control: public, max-age=31536000
Netlify-CDN-Cache-Control: public, max-age=31536000

*.woff2
Cache-Control: public, max-age=31536000
Netlify-CDN-Cache-Control: public, max-age=31536000

*.ttf
Cache-Control: public, max-age=31536000
Cache-Control: public, max-age=31536000
Netlify-CDN-Cache-Control: public, max-age=31536000
6 changes: 0 additions & 6 deletions public/_redirects

This file was deleted.

79 changes: 13 additions & 66 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,73 +153,20 @@ export default defineConfig(({ mode }) => {
outDir: 'dist',
rollupOptions: {
output: {
manualChunks: (id) => {
// Vendor chunks - split large dependencies
if (id.includes('node_modules')) {
if (id.includes('react')) {
return 'react-vendor';
}
if (id.includes('three')) {
return 'three-vendor';
}
if (id.includes('@radix-ui')) {
return 'radix-vendor';
}
if (id.includes('framer-motion')) {
return 'framer-vendor';
}
if (id.includes('socket.io')) {
return 'socket-vendor';
}
if (id.includes('recharts') || id.includes('victory')) {
return 'charts-vendor';
}
// Catch-all for other vendors
return 'vendor';
}

// Component chunks
if (id.includes('/components/')) {
if (id.includes('deity')) {
return 'deity-components';
}
if (id.includes('profile')) {
return 'profile-components';
}
if (id.includes('sadhana')) {
return 'sadhana-components';
}
if (id.includes('library')) {
return 'library-components';
}
if (id.includes('ui/')) {
return 'ui-components';
}
return 'components';
}

// Page chunks - split large landing pages
if (id.includes('/pages/')) {
if (id.includes('landing/')) {
return 'landing-pages';
}
if (id.includes('user/')) {
return 'user-pages';
}
return 'pages';
// Keep the main application bundle names stable so cached HTML never
// references a removed hashed asset after a fresh deployment.
entryFileNames: (chunk) =>
chunk.name === "index" ? "app/index.js" : "assets/[name]-[hash].js",
chunkFileNames: "assets/[name]-[hash].js",
assetFileNames: (assetInfo) => {
if (assetInfo.name?.endsWith(".css") && assetInfo.name.startsWith("index")) {
return "app/index.css";
}

// Hooks and utilities
if (id.includes('/hooks/')) {
return 'hooks';
}
if (id.includes('/utils/')) {
return 'utils';
}
if (id.includes('/lib/')) {
return 'lib';
}
}
return "assets/[name]-[hash][extname]";
},
// Allow Vite to manage code-splitting heuristics automatically to avoid
// circular dependencies between manually defined chunks that can cause
// runtime initialization errors in production bundles.
}
},
// Increase chunk size warning limit
Expand Down