Skip to content

Commit

Permalink
Refactor npm build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ijpatricio committed Dec 23, 2023
1 parent db3d722 commit 9f834df
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Livewire/HelloWorld.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class HelloWorld extends Component

public function component(): string
{
return 'HelloWorld';
return 'HelloWorld/index.jsx';
}
}
2 changes: 1 addition & 1 deletion app/Livewire/TodoList.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TodoList extends Component

public function component(): string
{
return 'TodoList';
return 'TodoList/index.js';
}

#[Renderless]
Expand Down
5 changes: 5 additions & 0 deletions app/Mingle/RendersJavaScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ trait RendersJavaScript
{
public $mingleId;

public function componentKey(): string
{
return Str::before($this->component(), '/');
}

public function mountRendersJavaScript()
{
$this->mingleId = 'mingle-' . Str::random();
Expand Down
2 changes: 1 addition & 1 deletion resources/mingle-views/mingle.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
console.log('Mingle init', window.Mingle)
document.addEventListener('livewire:initialized', () => {
window.Mingle['{{ $this->component() }}']
window.Mingle['{{ $this->componentKey() }}']
.create(
'{{ $this->mingleId }}',
window.Livewire.find('{{ $_instance->getId() }}'),
Expand Down

0 comments on commit 9f834df

Please sign in to comment.