-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
62 lines (61 loc) · 2.01 KB
/
Copy pathvite.config.ts
File metadata and controls
62 lines (61 loc) · 2.01 KB
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
62
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { componentTagger } from "lovable-tagger";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
server: {
host: "::",
port: 8080,
// Dev proxy for Sentry tunnel so requests to /monitoring succeed locally
proxy: {
"/monitoring": {
target: "https://o4510171038941184.ingest.de.sentry.io",
changeOrigin: true,
secure: true,
headers: {
"Content-Type": "application/x-sentry-envelope",
},
// Map the local /monitoring path to the Sentry envelope endpoint for the project
rewrite: (path) => "/api/4510171169357904/envelope",
},
},
},
plugins: [react(), mode === "development" && componentTagger()].filter(Boolean),
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
rollupOptions: {
output: {
// Ensure consistent chunk names for better caching
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: (assetInfo) => {
const info = assetInfo.names?.[0]?.split('.') || [];
const extType = info[info.length - 1];
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType || '')) {
return `assets/images/[name]-[hash][extname]`;
}
if (/css/i.test(extType || '')) {
return `assets/css/[name]-[hash][extname]`;
}
return `assets/[name]-[hash][extname]`;
},
},
},
// Enable source maps for better debugging in production
sourcemap: mode !== 'production',
// Ensure manifest.json and service worker are copied to dist
assetsInlineLimit: 0,
},
// PWA specific configurations
publicDir: 'public',
base: '/',
// Ensure service worker and manifest are served correctly
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version || '1.0.0'),
},
}));