Plugin development: JS file net::ERR_ABORTED 404 (Not Found)

<?php

namespace TheThunderTurner\FilamentLatex;

use Filament\Support\Assets\AlpineComponent;
use Filament\Support\Facades\FilamentAsset;
use Livewire\Livewire;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class FilamentLatexServiceProvider extends PackageServiceProvider
{
public static string $name = 'filament-latex';

public function configurePackage(Package $package): void
{
$package->name(static::$name)
->hasViews()
->hasTranslations();
}

public function packageBooted(): void
{
Livewire::component('filament-latex', FilamentLatex::class);

FilamentAsset::register(
assets: [
AlpineComponent::make('filament-latex', __DIR__ . '/../resources/dist/filament-latex.js'),
],
package: 'thethunderturner/filament-latex'
);
}
}
<?php

namespace TheThunderTurner\FilamentLatex;

use Filament\Support\Assets\AlpineComponent;
use Filament\Support\Facades\FilamentAsset;
use Livewire\Livewire;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class FilamentLatexServiceProvider extends PackageServiceProvider
{
public static string $name = 'filament-latex';

public function configurePackage(Package $package): void
{
$package->name(static::$name)
->hasViews()
->hasTranslations();
}

public function packageBooted(): void
{
Livewire::component('filament-latex', FilamentLatex::class);

FilamentAsset::register(
assets: [
AlpineComponent::make('filament-latex', __DIR__ . '/../resources/dist/filament-latex.js'),
],
package: 'thethunderturner/filament-latex'
);
}
}
export default function clockWidget() {
return {
time: new Date().toLocaleTimeString(),
init() {
setInterval(() => {
this.time = new Date().toLocaleTimeString();
}, 1000);
}
}
}
export default function clockWidget() {
return {
time: new Date().toLocaleTimeString(),
init() {
setInterval(() => {
this.time = new Date().toLocaleTimeString();
}, 1000);
}
}
}
<x-filament-panels::page>
<x-filament::section>
<x-slot name="heading">
Test
</x-slot>

<div
x-ignore
ax-load
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('filament-latex', 'thethunderturner/filament-latex') }}"
x-data="clockWidget()"
class="text-center"
>
<p class="text-xl" x-text="time"></p>
</div>
</x-filament::section>
</x-filament-panels::page>
<x-filament-panels::page>
<x-filament::section>
<x-slot name="heading">
Test
</x-slot>

<div
x-ignore
ax-load
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('filament-latex', 'thethunderturner/filament-latex') }}"
x-data="clockWidget()"
class="text-center"
>
<p class="text-xl" x-text="time"></p>
</div>
</x-filament::section>
</x-filament-panels::page>
3 Replies
Matthew
MatthewOP4d ago
Error: GET http://localhost:8000/js/thethunderturner/filament-latex/components/filament-latex.js?v=dev-main net::ERR_ABORTED 404 (Not Found) Anyone?
awcodes
awcodes4d ago
php artisan filament:assets Registering plugin scripts will publish them to the public folder when someone installs your plugin. During development though you need to manually publish it anytime you make changes.
Matthew
MatthewOP4d ago
Ah yess, I forgot about that. I will try as soon as I get home Thx
Want results from more Discord servers?
Add your server