Use relative Vite asset links in rebuild

Load compiled assets from /build using the manifest so Coolify deployments do not depend on APP_URL or proxy scheme detection for CSS.
This commit is contained in:
Power BI Dev
2026-05-03 19:51:09 +07:00
parent 80f3e52596
commit b95d7fed02

View File

@@ -8,7 +8,18 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
@vite(['resources/css/app.css', 'resources/js/app.js'])
@php
$viteManifestPath = public_path('build/manifest.json');
$viteManifest = file_exists($viteManifestPath) ? json_decode(file_get_contents($viteManifestPath), true) : [];
$viteCss = $viteManifest['resources/css/app.css']['file'] ?? null;
$viteJs = $viteManifest['resources/js/app.js']['file'] ?? null;
@endphp
@if ($viteCss && $viteJs)
<link rel="stylesheet" href="/build/{{ $viteCss }}">
<script type="module" src="/build/{{ $viteJs }}"></script>
@else
@vite(['resources/css/app.css', 'resources/js/app.js'])
@endif
</head>
<body class="min-h-screen bg-white font-[Inter] text-[#374151] antialiased">
@php