Compile unprefixed components to the same view on every machine
tests / lint (push) Successful in 1m3s
tests / feature (8.4) (push) Successful in 1m14s
tests / feature (8.5) (push) Successful in 1m14s
tests / browser (chrome, chromium) (push) Successful in 3m16s
tests / browser (firefox, firefox) (push) Successful in 4m36s
tests / browser (safari, webkit) (push) Successful in 5m8s

Without a prefix, Blade named the components' view namespace after the
folder's absolute path, while compiled views are named relative to the
application. A view compiled on a laptop and served from a container
sharing storage/framework/views (or from another release directory)
printed 'eb5f…::input' as text. The components now register under the
prefix livewire-material when none is configured, which unprefixed tags
still resolve through, and the path's namespace stays registered for
views compiled before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
Andreas Reinhold / reini
2026-09-13 11:16:52 +02:00
co-authored by Claude Opus 5
parent cb3aa798a0
commit 7798352cfc
2 changed files with 29 additions and 4 deletions
+16 -2
View File
@@ -20,9 +20,23 @@ function packageComponentPaths(): Collection
->values();
}
it('registers the components without a prefix', function () {
it('registers the components under its own name when no prefix is configured', function () {
expect(packageComponentPaths())->toHaveCount(1)
->and(packageComponentPaths()->first()['prefix'])->toBeNull();
->and(packageComponentPaths()->first()['prefix'])->toBe('livewire-material')
->and(Blade::render('<x-badge value="New" tonal />'))->toContain('New');
});
it('compiles an unprefixed component to the same view on every machine', function () {
$compiled = Blade::compileString('<x-input label="Name" />');
expect($compiled)->toContain("'view' => '".hash('xxh128', 'livewire-material')."::input'")
->not->toContain(hash('xxh128', LivewireMaterialServiceProvider::componentPath()));
});
it('still renders a view compiled when the namespace came from the component path', function () {
$legacy = hash('xxh128', LivewireMaterialServiceProvider::componentPath());
expect(view()->exists($legacy.'::input'))->toBeTrue();
});
it('registers the components under a configured prefix', function () {