© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
Prodex

Include JS Asset: "Identifier X has already been declared"

If I include JavaScript like the docs say, it doesn't bundle it through vite, so this doesn't work:
        FilamentAsset::register([
            Js::make('sentry',  __DIR__ . '/../../resources/js/sentry.js'),
        ]);
        FilamentAsset::register([
            Js::make('sentry',  __DIR__ . '/../../resources/js/sentry.js'),
        ]);


If I use the Vite facade it does load the correct file, but I get "Identifier X has already been declared", because vite doesn't know, that there are other assets as well.
        FilamentAsset::register([
            Js::make('sentry', Vite::asset('resources/js/sentry.js')),
        ]);
        FilamentAsset::register([
            Js::make('sentry', Vite::asset('resources/js/sentry.js')),
        ]);


How can I avoid this problem?
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

The email has already been taken.
FilamentFFilament / ❓┊help
3y ago
Exclude specific pages from JS asset registration
FilamentFFilament / ❓┊help
2y ago
[Error] Unhandled Promise Rejection: SyntaxError: JSON Parse error: Unexpected identifier "x".
FilamentFFilament / ❓┊help
2y ago
How to include Vite compiled JS into admin panel?
FilamentFFilament / ❓┊help
3y ago