Enable Flare JS error logging

I would like to integrate Flares client side JS error logging (https://flareapp.io/docs/integration/javascript-error-tracking/installation). The problem is that I cannot link to Vite assets in Filament because that will create a circular dependency.
FilamentAsset::register([
Js::make('app-js', Vite::asset('resources/js/app.js')),
]);
FilamentAsset::register([
Js::make('app-js', Vite::asset('resources/js/app.js')),
]);
import { flare } from "@flareapp/js";

const env = process.env.NODE_ENV;
if (env === "production" || env === "staging") {
flare.light();
}
import { flare } from "@flareapp/js";

const env = process.env.NODE_ENV;
if (env === "production" || env === "staging") {
flare.light();
}
When doing this Vite will require a manifest which can only be generated after composer is installed which can only happen after the manifest is generated... etc. How should I solve this?
Solution:
This fixed it for me: ```php <?php ...
Jump to solution
1 Reply
Solution
Proculair B.V.
Proculair B.V.3mo ago
This fixed it for me:
<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Filament\View\PanelsRenderHook;
use Illuminate\Support\Facades\Blade;
// ...

class AppPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...

->renderHook(
PanelsRenderHook::BODY_END,
fn (): string => Blade::render("@vite('resources/js/app.js')")
);
}
}
<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Filament\View\PanelsRenderHook;
use Illuminate\Support\Facades\Blade;
// ...

class AppPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...

->renderHook(
PanelsRenderHook::BODY_END,
fn (): string => Blade::render("@vite('resources/js/app.js')")
);
}
}
Want results from more Discord servers?
Add your server