If you encounter caching issues with your @teleport Livewire/Blade directive after running php artisan view:cache, you may notice problems appearing instead of the expected compilation.
To resolve this issue, manually add compilation to the Blade directive.
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
app('blade.compiler')->directive('teleport', function ($expression) {
return "<template x-teleport='<?php echo e($expression); ?>'>";
});
app('blade.compiler')->directive('endteleport', function () {
return "</template>";
});
}
}