This commit is contained in:
62
frontend/astro.config.mjs
Normal file
62
frontend/astro.config.mjs
Normal file
@@ -0,0 +1,62 @@
|
||||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import node from '@astrojs/node';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import preact from '@astrojs/preact';
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
|
||||
adapter: node({
|
||||
mode: 'standalone'
|
||||
}),
|
||||
|
||||
// 🛰️ Postavke razvojnog poslužitelja unutar Docker mreže
|
||||
server: {
|
||||
host: true, // Sluša na 0.0.0.0 unutar kontejnera
|
||||
port: 4321, // Unutarnji port kontejnera
|
||||
},
|
||||
|
||||
vite: {
|
||||
resolve: {
|
||||
alias: {
|
||||
react: 'preact/compat',
|
||||
'react-dom': 'preact/compat',
|
||||
'react-dom/test-utils': 'preact/test-utils',
|
||||
'react/jsx-runtime': 'preact/jsx-runtime',
|
||||
'react/jsx-dev-runtime': 'preact/jsx-dev-runtime',
|
||||
},
|
||||
},
|
||||
define: {
|
||||
__PUSHER_KEY__: JSON.stringify(process.env.PUBLIC_PUSHER_KEY || process.env.PUSHER_KEY || ''),
|
||||
__PUSHER_CLUSTER__: JSON.stringify(process.env.PUBLIC_PUSHER_CLUSTER || process.env.PUSHER_CLUSTER || ''),
|
||||
},
|
||||
ssr: {
|
||||
noExternal: ['@react-spring/web', '@react-spring/core', '@react-spring/animated', '@react-spring/shared'],
|
||||
},
|
||||
build: {
|
||||
assetsInlineLimit: 1024,
|
||||
},
|
||||
plugins: [tailwindcss()],
|
||||
|
||||
// ⚙️ Ugrađene preporuke za Docker File Watching i Tihi Refresh (HMR)
|
||||
server: isDev ? {
|
||||
hmr: {
|
||||
protocol: 'ws',
|
||||
host: 'localhost',
|
||||
// Mora odgovarati mapiranom portu u docker-compose (4321:4321)
|
||||
clientPort: 4321,
|
||||
},
|
||||
watch: {
|
||||
// Prisiljava Vite na "polling" sustav jer Windows/WSL2 volumeni nekad blokiraju inotify signale
|
||||
usePolling: true,
|
||||
interval: 100,
|
||||
}
|
||||
} : {}, // U produkciji je ovaj blok potpuno prazan radi maksimalnih performansi
|
||||
},
|
||||
|
||||
// Redoslijed integracija: Tailwind pa Preact
|
||||
integrations: [preact()],
|
||||
});
|
||||
Reference in New Issue
Block a user