-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Error Message and Logs
Following a recent update (version needed), my React/Vite Single Page Application (SPA) deployed via Coolify now fails to deploy or run correctly unless the "Static Site" checkbox is explicitly ticked.
Prior to the update, I was able to deploy the application with client-side routing (React Router) without any extra build steps, as Coolify correctly configured the underlying web server (Nginx/Caddy) for SPAs.
The current behavior presents a Catch-22:
"Static Site" Ticked (Current Forced Workaround): The application deploys quickly, but sub-routes (like /dashboard) fail on refresh with the Nginx 404 error (as the server is not configured to fall back to index.html).
"Static Site" Unticked (Correct SPA Mode): The deployment process takes hours and often results in a MIME type error (Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "text/plain"), indicating the web server is incorrectly serving the bundled JavaScript assets.
Expected Behavior
The application should deploy successfully with the "Static Site" option unticked (to enable SPA routing) and the deployed web server should correctly serve all bundled JavaScript/Module files with the MIME type application/javascript (or text/javascript).
Steps to Reproduce
Use a standard React application built with Vite (using npm run build to create a dist folder).
In Coolify, configure a new resource for the application, ensuring:
Build Tool: Nixpacks is used.
Build Command: npm ci && npm run build
Output Directory: dist
Static Site: Unticked/Disabled.
Initiate deployment.
Observe the long build time, followed by the MIME type error in the browser console upon attempting to load the site.
Example Repository URL
No response
Coolify Version
v4.0.0-beta.440
Are you using Coolify Cloud?
No (self-hosted)
Operating System and Version (self-hosted)
No response
Additional Information
No response