blade-heroicons: Cannot run Optimize command with Laravel 11

  • Library Version: 2.3.0
  • Laravel Version: 11.0.5
  • PHP Version: 8.3.3

Description:

I upgraded an existing app to Laravel 11, tests ran fine, but it failed during deployment running php artisan optimize. The page works fine when viewed in a browser (the icon appears). I tried to determine if it was something specific to my project but I was able to replicate this in a brand new Laravel 11 project also.

➜  heroicons php artisan optimize

   INFO  Caching framework bootstrap, configuration, and metadata.  

  config ............................................................................................................................... 7.62ms DONE
  events ............................................................................................................................... 0.71ms DONE
  routes ............................................................................................................................... 5.56ms DONE
  views ............................................................................................................................... 28.61ms FAIL

   InvalidArgumentException 

  Unable to locate a class or view for component [heroicon-s-bars-3].

  at vendor/laravel/framework/src/Illuminate/View/Compilers/ComponentTagCompiler.php:311
    307▕         if (Str::startsWith($component, 'mail::')) {
    308▕             return $component;
    309▕         }
    310▕ 
  ➜ 311▕         throw new InvalidArgumentException(
    312▕             "Unable to locate a class or view for component [{$component}]."
    313▕         );
    314▕     }
    315▕ 

      +2 vendor frames 

  3   [internal]:0
      Illuminate\View\Compilers\ComponentTagCompiler::Illuminate\View\Compilers\{closure}(["<x-heroicon-s-bars-3 />", "heroicon-s-bars-3", "", ""])
      +7 vendor frames 

  11  [internal]:0
      Illuminate\Foundation\Console\ViewCacheCommand::Illuminate\Foundation\Console\{closure}(Object(Symfony\Component\Finder\SplFileInfo), "/Users/dwight/Sites/heroicons/resources/views/welcome.blade.php")

Steps To Reproduce:

Create a new Laravel 11 project, add this library.

laravel new heroicons
cd heroicons
composer require blade-ui-kit/blade-heroicons

Add an icon to the welcome page: <x-heroicon-s-bars-3 />

php artisan optimize

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Best of luck and congratulations, @driesvints! I faced the same issue, and will try to debug today.

Yeah - this is back in action for me after updating. Nice catch @Jubeki

This seems to be fixed in laravel/framework v11.8.0.

Not exactly sure where it was fixed, probably related PR in the framework: https://github.com/laravel/framework/pull/51450