I've ran into a weird issue today while using the new components from Laravel 7. I've created a WeeklyStats component (php artisan make:component WeeklyStats) and displayed it with
<x-weeklystats/>
in my local environment (Laravel Valet).
Everything works, loads, etc.
Problem appeared after deploying to my production server.
I kept getting the error "Unable to locate a class or view for component [weeklystats]. at [truncated]/vendor/laravel/framework/src/Illuminate/View/Compilers/ComponentTagCompiler.php:234)"
It only worked after i've used the same name as the view the component was loading
<x-weekly-stats/>
I've read the documentation and it states that "Blade component tags start with the string x- followed by the kebab case name of the component class". It's at least confusing because WeeklyStats kebab-cased is not weekly-stats.
Also, the other confusing part is why it worked locally in the first place. I did check after clearing all the cache and compiled views.
Hi @neamtua, when you run Str::kebab() on "WeeklyStats", it does in fact return "weekly-stats".
Why would it not be weekly-stats?
Before you close it, why does it work on Valet with <x-weeklystats>?
Could it be that your production server uses case sensitive file system while your local environment does not
Could it be that your production server uses case sensitive file system while your local environment does not
Sorry for commenting on a closed issue, but I just ran into this and this was indeed the case with a project I am working on. The client uses shared hosting and changing the component file name to only lower case worked on the production server.
Most helpful comment
Could it be that your production server uses case sensitive file system while your local environment does not