Paweł Czekaj
Paweł Czekaj

Reputation: 63

vercel laravel deployment static files not loading (js, css not loaded )

Build-generated static files are not loading after deploying laravel app to vercel, I tried different vercel.json "routes" options found in various responses and those didn't work:/ My output in vercecl is set to "/api" ( otherwise deployment fails ). Here's verccel settings file:

vercel.json:

{
    "version": 2,
    "framework": null,
    "functions": {
        "api/index.php": { "runtime": "[email protected]" }
    },
    "builds": [
        { "src": "/public/**", "use": "@vercel/static" }
    ],
    "routes": [
        {
            "src": "/(css|js|vendor|assets|build)/(.*)",
            "dest": "public/$1/$2"
        },
     {
        "src": "/(.*)",
        "dest": "/api/index.php"
    }    ],
    "env": {
        "APP_ENV": "production",
        "APP_DEBUG": "true",
        "APP_URL": "wieniolaravel.vercel.app",

        "APP_CONFIG_CACHE": "/tmp/config.php",
        "APP_EVENTS_CACHE": "/tmp/events.php",
        "APP_PACKAGES_CACHE": "/tmp/packages.php",
        "APP_ROUTES_CACHE": "/tmp/routes.php",
        "APP_SERVICES_CACHE": "/tmp/services.php",
        "VIEW_COMPILED_PATH": "/tmp",

        "CACHE_DRIVER": "array",
        "LOG_CHANNEL": "stderr",
        "SESSION_DRIVER": "cookie"
    }
}

app console errors

Upvotes: 0

Views: 29

Answers (0)

Related Questions