#Enable Flare JS error logging

3 messages · Page 1 of 1 (latest)

quartz nacelle
#

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')),
]);
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?

civic basaltBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

quartz nacelle
#

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')")
            );
    }
}