Bundling js files with vite
Hello everyone,
I’m using filament packages a lot on frontend lately. Was wondering if anyone had success bundling all filament js in a single file using vite.
If so, if you could share your approach, it would be great!
Thank you!
3 Replies
Hmm, there’s a reason they are split. It’s so they can be asynchronously loaded when needed.
They are all loading as they’re imported to the app js when using outside of filament panels. Wether you’re calling the package or not in that view.
I followed the official guide, maybe I’m missing something?
Maybe I misunderstood too. But like all the form component js files are async alpine components meaning the js won’t be loaded unless the components actually exist in the output. Thats what I’m getting at. Ie, you wouldn’t want to load the js for a rich editor if there wasn’t an editor on the page.
And unless something has changed, I believe Vite has some issues with async alpine components.