Laravel with vercel-php@0.4.0 css/js was not loaded because its MIME type
See original GitHub issueQuestion
/css/app.css?id=63d00dfbd8cde5c569e7 was not loaded because its MIME type, “text/html”, is not “text/css”.
Works if upload public/css/ public/js file to vercel. But I want use Composer build in vercel
Here are my config files: Composer scripts:
"vercel": [
"@php -v",
"npm -v",
"npm install && npm run prod"
],
api/assets.php :
<?php
// File: api/assets.php
$queries = array();
parse_str($_SERVER['QUERY_STRING'], $queries);
$file = $queries['file'];
echo require __DIR__ . '/../' . $file;
vercel.json:
{
"version": 2,
"functions": {
"api/assets.php": { "runtime": "vercel-php@0.4.0" },
"api/index.php": { "runtime": "vercel-php@0.4.0" }
},
"routes": [
{
"src": "/(css|js)/(.*)",
"dest": "/api/assets.php?file=public/$1/$2"
},
{
"src": "/(.*)",
"dest": "/api/index.php"
}
],
...
related:
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Stylesheet not loaded because of MIME type - Stack Overflow
The fastest way to check it is just to try to open the file directly http://localhost:3000/assets/styles/custom-style.css in a new tab. – ...
Read more >Laravel CSS Not Working |JS Not Working | Assets ... - YouTube
In this video, I'm gonna be talking about Laravel HTTPS configurations. We will be fixing some of the basic problems that occur when...
Read more >UNsupported stylesheet - Laracasts
Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is...
Read more >CSS / JavaScript - Laravel Nova
So, you are free to leverage all Tailwind features and classes that are needed by your custom components. # JavaScript. When building custom...
Read more >MIME Type is being forced to HTML. What's wrong? : r/PHPhelp
Now the file cannot be sourced to webpages because the MIME-type is ... does not and cannot alter the content type from a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I use the
builds
options but since it’s technically deprecated I’m not sure how long it will technically last.Hi @guoxiangke. There is no way how to detect which composer script you want to run in single deployment.