Skip to content

Comments

Fix custom components without Blaze#2411

Closed
ganyicz wants to merge 1 commit intomainfrom
filip/fix-custom-components-without-blaze
Closed

Fix custom components without Blaze#2411
ganyicz wants to merge 1 commit intomainfrom
filip/fix-custom-components-without-blaze

Conversation

@ganyicz
Copy link
Collaborator

@ganyicz ganyicz commented Feb 19, 2026

The scenario

A user has Blaze installed and uses a custom Flux icon or variant:

<flux:icon name="custom" />

Where "custom" is a Blade view in resources/views/flux/icon/custom.blade.php without a @blaze directive.

The problem

The icon component uses flux::delegate-component and Blaze assumes all delegate targets are optimized.

But the custom icon template doesn't have @blaze, therefore it's not compiled into a function.

Resulting in an exception:

Call to undefined function _eab27ebdf4ee954a9a05ceed5425e512()

The solution

Call Blaze::optimize()->in() on the custom Flux component path (resources/views/flux), so all templates in that directory are automatically optimized — no @blaze directive needed.

if (class_exists(\Livewire\Blaze\Blaze::class)) {
    \Livewire\Blaze\Blaze::optimize()->in(resource_path('views/flux'));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant