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,24 +1,25 @@
/**
* Vite-Konfiguration für Backend (Portal)
* - Domain: pressekonto.test
* Vite-Konfiguration für Backend/Admin (FluxUI)
* - Domain: pressekonto.test (Admin, Customer, Auth)
* - Asset-Subdomain: assets.pressekonto.test
* - Port: 5177
* - Verwendet FluxUI
* - Build-Verzeichnis: public/build/portal
* - Build: public/build/portal
*
* Öffentliche Hub-Landing und Frontends vite.web.config.js (dev:web)
*
* Starten mit: npm run dev:portal
*/
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import tailwindcss from "@tailwindcss/vite";
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 {
PORTAL_HMR_HOST,
PORTAL_HOT_FILE,
PORTAL_PORT,
createWatchIgnored,
portalRefreshPaths,
portalWatchDirs,
} from "./vite.shared.js";
export default defineConfig({
plugins: [
@ -28,24 +29,28 @@ export default defineConfig({
"resources/js/app.js",
"resources/js/portal-form-hooks.js",
],
refresh: ["resources/views/portal/**/*.blade.php"],
refresh: portalRefreshPaths,
hotFile: PORTAL_HOT_FILE,
}),
tailwindcss({
config: "./tailwind.portal.config.js",
}),
],
server: {
https: false, // Traefik übernimmt SSL, Vite läuft intern auf HTTP
https: false,
cors: true,
host: "0.0.0.0",
port: 5174, // oder 5175
hmr: {
host: "assets.pressekonto.test",
protocol: "wss", // Explizit wss für WebSocket Secure
// WICHTIG: Die 'port'-Angabe hier entfernen!
// Der Browser soll den Standard-Port (443) von Traefik nutzen.
port: PORTAL_PORT,
strictPort: true,
allowedHosts: ["pressekonto.test", PORTAL_HMR_HOST, "localhost", "0.0.0.0"],
watch: {
ignored: createWatchIgnored(portalWatchDirs),
},
// Das origin ist nicht mehr notwendig, da der HMR-Port wegfällt.
hmr: {
host: PORTAL_HMR_HOST,
protocol: "wss",
},
origin: `https://${PORTAL_HMR_HOST}`,
},
build: {
outDir: "public/build/portal",