So, here I am again. Came back to Vue after trying everything else to sprinkle in "reactivity" and UX-ness to my pages. Tried already Vanilla, jQuery, AlpineJS, Livewire to sprinkle in the goodness. VueJS is great and just as easy as everything else mentioned in my previous sentence. But the huge library of ready components found online makes developing front-end stuff fast and easy with Vue and you don't have to reinvent the wheel for simple stuff. I need a pro's experience for the following scenario.
// layouts/base.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title')</title>
<!-- Styles -->
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
</head>
<body>
@yield('content')
<script src="{{ mix('js/manifest.js') }}" defer></script>
<script src="{{ mix('js/vendor.js') }}" defer></script>
<script src="{{ mix('js/app.js') }}" defer></script>
</body>
</html>
The above file is loaded by all my pages except the Auth pages (these load layouts/guest.blade.php)
I'm in a situation where every single page requires a different Vue Component here and there. Not for silly stuff like opening a sidebar, but for stuff like a tickets page. Where you have a page to view the ticket and reply. That reply area is a view component that also loads sub-components eg a nice search-as-you-type dropdown. Another page or even the previous page example, my have a "chat widget" hanging about. Or simple switches to turn on/off settings.
My question is:
Should I use one single app.js that is loaded on every page with a global <div id="app">@yield('content')</div> that imports every component regardless if individual pages make use of that component OR should I create many *.js (tickets-page.js, posts-page.js, etc.) that load only the required components for that particular page? My main concern is file download size and if by using a single app.js that globally registers the components I will get a huge app.js file and/or {manifest|vendor}.js file.
Does my question make sense? Sorry if it was asked before I haven't found it. Feel free to delete my post and point me to the thread where it was asked before.
P.S.
I can't use SPA even if it is SSR. When I'm having trouble figuring the simple stuff above image I have to setup SPA and SSR.