© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
1 reply
Aivirth

How to properly add custom js files to Filament panel.

I'm in the process of building a custom alpine component which i'm using in a specific custom page of the panel, so far so good. Everything works properly in local but when i deployed the project to production i encountered an error where the file was aggressively cached which caused the entire thing to blow up by not loading the newest version of it, the only solution i found at the time was to change the name of the script.
This brought me to believe my approach to the entire thing was faulty, right now i'm including the script directly in the boot method of the custom page
\Filament\Support\Facades\FilamentAsset::register([
            \Filament\Support\Assets\Js::make('taskjob-recorder', __DIR__ . '/../../resources/js/taskjob-recorder.js'),
        ]);
\Filament\Support\Facades\FilamentAsset::register([
            \Filament\Support\Assets\Js::make('taskjob-recorder', __DIR__ . '/../../resources/js/taskjob-recorder.js'),
        ]);

I tried to change my approaching by registering the script into AppServiceProvider which worked, unless i called the
->loadedOnRequest
->loadedOnRequest
method to allow the x-load-js to lazyload it
in that case it never managed to register the file at the bottom of the page as the documentation says,

Is there a better approach to this ? it would also help in the future to know how to include npm packages into the panel and in specific pages if possible.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Add custom js to specific panel
FilamentFFilament / ❓┊help
3y ago
Remove uploaded files in Filament admin panel
FilamentFFilament / ❓┊help
3y ago
How add Filament to Webpage
FilamentFFilament / ❓┊help
11mo ago
Custom JS in filament page
FilamentFFilament / ❓┊help
3y ago