-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
67 lines (58 loc) · 2.29 KB
/
Copy pathastro.config.mjs
File metadata and controls
67 lines (58 loc) · 2.29 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
63
64
65
66
67
import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
// ─── Dev Bridge Integration ────────────────────────────────────────────────────
// Подключается ТОЛЬКО в dev-режиме и вешает fetch-only API на тот же порт Astro.
const devIntegrations = [];
if (process.env.NODE_ENV !== 'production') {
try {
const { devBridgeIntegration } = await import('./scripts/devBridge.mjs');
devIntegrations.push(devBridgeIntegration());
} catch (e) {
console.warn('[hub-dev] devBridge not loaded:', e.message);
}
}
export default defineConfig({
integrations: [react(), ...devIntegrations],
site: 'https://opensophy.com',
trailingSlash: 'always',
output: 'static',
srcDir: './src/app',
build: {
assets: 'assets',
},
vite: {
ssr: {
external: ['isomorphic-dompurify'],
},
optimizeDeps: {
include: ['react', 'react-dom', 'marked', 'framer-motion', 'lucide-react', 'recharts'],
},
build: {
chunkSizeWarningLimit: 1000,
rollupOptions: {
output: {
entryFileNames: 'assets/[name].[hash].js',
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[hash][extname]',
manualChunks(id) {
// Dev panel → отдельный чанк (в prod его нет в бандле)
if (id.includes('dev-panel')) return 'dev-panel';
if (id.includes('node_modules/lucide-react')) return 'lucide';
if (id.includes('node_modules/react-dom')) return 'vendor-react';
if (id.includes('node_modules/react/')) return 'vendor-react';
if (id.includes('node_modules/framer-motion')) return 'vendor-motion';
if (
id.includes('node_modules/marked') ||
id.includes('node_modules/isomorphic-dompurify')
) return 'vendor-markdown';
if (
id.includes('node_modules/recharts') ||
id.includes('node_modules/d3-') ||
id.includes('node_modules/victory-vendor')
) return 'vendor-charts';
},
},
},
},
},
});