F
Filament10mo ago
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?
2 Replies
Lara Zeus
Lara Zeus10mo ago
why not using the compiled version
FilamentAsset::register([
Js::make('sentry', asset('js/sentry.js')),
]);
FilamentAsset::register([
Js::make('sentry', asset('js/sentry.js')),
]);
Prodex
ProdexOP10mo ago
that's not working, how should the compiled version hash be resolved?
Want results from more Discord servers?
Add your server