Multi-Domain-Asset-Infrastruktur: geteilte Vite-Konfiguration und DomainAssetContext

- vite.shared.js als gemeinsame Quelle fuer Ports, Hot-Files, HMR-Hosts
  und CORS-Origins der beiden Vite-Builds (Portal/Web)
- App\Support\DomainAssetContext kapselt die Vite-Build-Directory-
  Konfiguration pro Domain (ThemeServiceProvider + Auth-Layout nutzen ihn)
- Tailwind-Portal-Content-Globs auf die tatsaechliche View-Struktur gezogen
- Dev-Beispiel-Routen + Tests (DomainAssetContextTest, DevExampleRoutesTest)
- Aufraeumen: versehentliche Leerdatei dev:web entfernt

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-06-12 08:16:09 +00:00
parent 4bb9094207
commit 0efabaf446
15 changed files with 485 additions and 109 deletions

View file

@ -1,63 +1,62 @@
/**
* Vite-Konfiguration für öffentliche Frontends (Web)
* - Domains: pressekonto.test (Hub), presseecho.test, businessportal24.test
* - Asset-Subdomains: assets.pressekonto.test, assets.presseecho.test, assets.businessportal24.test
* - Port: 5178
* - Build: public/build/web
*
* Backend/Admin auf pressekonto.test vite.portal.config.js (dev:portal)
*
* Starten mit: npm run dev:web
*/
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import tailwindcss from "@tailwindcss/vite";
// SSL-Konfiguration - für Entwicklung ohne echte Zertifikate
const httpsConfig =
process.env.NODE_ENV === "production"
? {
// In Produktion: echte Zertifikate verwenden
key: process.env.SSL_KEY_PATH,
cert: process.env.SSL_CERT_PATH,
}
: true; // Self-signed für Entwicklung
import {
WEB_ALLOWED_HOSTS,
WEB_CORS_ORIGINS,
WEB_HOT_FILE,
WEB_PORT,
createWatchIgnored,
webRefreshPaths,
webWatchDirs,
} from "./vite.shared.js";
export default defineConfig({
plugins: [
laravel({
input: [
// Web Theme CSS Dateien
"resources/css/web/theme-businessportal24.css",
"resources/css/web/theme-presseecho.css", // Neu: CSS für presseecho hinzugefügt, um beide Themes vorab zu kompilieren
"resources/css/web/theme-pressekonto.css", // Hub-Landing pressekonto.de
"resources/css/web/theme-presseecho.css",
"resources/css/web/theme-pressekonto.css",
"resources/js/app.js",
],
refresh: ["resources/views/web/**/*.blade.php"],
refresh: webRefreshPaths,
hotFile: WEB_HOT_FILE,
}),
tailwindcss({
config: "./tailwind.web.config.js",
}),
],
server: {
https: false, // Traefik übernimmt SSL, Vite läuft intern auf HTTP
https: false,
watch: {
ignored: createWatchIgnored(webWatchDirs),
},
cors: {
origin: [
"https://businessportal24.test",
"https://assets.businessportal24.test",
],
origin: WEB_CORS_ORIGINS,
credentials: true,
},
host: "0.0.0.0",
port: 5178, // Web-spezifischer Port
port: WEB_PORT,
strictPort: true,
allowedHosts: [
"assets.businessportal24.test",
"businessportal24.test",
"assets.presseecho.test", // Neu: presseecho-Host hinzugefügt
"presseecho.test", // Neu: presseecho-Host hinzugefügt
"assets.pressekonto.test", // Hub-Landing pressekonto.de
"pressekonto.test", // Hub-Landing pressekonto.de
"localhost",
"0.0.0.0",
],
allowedHosts: WEB_ALLOWED_HOSTS,
hmr: {
host: "assets.businessportal24.test",
protocol: "wss",
},
origin: "https://assets.businessportal24.test", // Ohne Port!
},
build: {
outDir: `public/build/web`,
outDir: "public/build/web",
assetsDir: "",
manifest: "manifest.json",
rollupOptions: {
@ -66,4 +65,4 @@ export default defineConfig({
},
},
},
});
});