New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
view:cache behaves differently when called by optimize command #50619
Comments
This seems to be a specific issue with how the package register view components (or how caching config) affects the way packages register the view components. |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
In the protected function loadViewsFrom($path, $namespace)
{
dd($this->app['view']->getEngineResolver()->resolve('blade')->getCompiler());
$this->callAfterResolving('view', function ($view) use ($path, $namespace) {
if (
isset($this->app->config['view']['paths']) &&
is_array($this->app->config['view']['paths'])
) {
foreach ($this->app->config['view']['paths'] as $viewPath) {
if (is_dir($appPath = $viewPath . '/vendor/' . $namespace)) {
$view->addNamespace($namespace, $appPath);
}
}
}
$view->addNamespace($namespace, $path);
});
} You get the correct instance with the icons loaded. However, if you put the dd one line below: protected function loadViewsFrom($path, $namespace)
{
$this->callAfterResolving('view', function ($view) use ($path, $namespace) {
dd($this->app['view']->getEngineResolver()->resolve('blade')->getCompiler());
if (
isset($this->app->config['view']['paths']) &&
is_array($this->app->config['view']['paths'])
) {
foreach ($this->app->config['view']['paths'] as $viewPath) {
if (is_dir($appPath = $viewPath . '/vendor/' . $namespace)) {
$view->addNamespace($namespace, $appPath);
}
}
}
$view->addNamespace($namespace, $path);
});
} You get a completely new instance without new icons. I don't know where to go from here though, maybe someone with more knowledge can check this out. Also this does not apply when just running |
I have the same issue but only on production server on AlmaLinux 8. |
Laravel Version
11.0.7
PHP Version
8.3.3
Database Driver & Version
No response
Description
This is a little tricky, but I ran into this issue after upgrading to Laravel 11 and first suspected it was a problem with Blade Heroicons Kit.
In Laravel 11 the
optimize
command was extended to cache events and views.When running optimize on a fresh app with the Heroicons kit it blew up:
However, running
php artisan view:cache
runs fine.Through playing with the
optimize
command I realised two things:config
orroute
caching fromoptimize
then it works fine. Something that happens in theconfig:cache
orroute:cache
command is affecting what happens in theview:cache
command.BladeCompiler
from the container and the one that is received inside theViewCacheCommand
appear to be different (and the second doesn't have the Heroicon aliases available)Steps To Reproduce
laravel new heroicons cd heroicons composer require blade-ui-kit/blade-heroicons
Add an icon to the welcome page:
<x-heroicon-s-bars-3 />
The text was updated successfully, but these errors were encountered: