Hi, I have done this with a Laravel project. Yes, I would class this as an MPA. I don't think there is a single correct answer for what you're asking. Just find what works, by now, you probably already have.
Here's my answer, to the best of my ability trying to exclude Laravelisms. I hope it is helpful, but there are probably better ways.
Let's say you have a very large application and there are three different areas "Human Resources", "Safety Reports" and "Project Management". Each their own stand-alone application. People have argued with me that all of the Javascript for these should be in a single file because of "tree shaking" and other reasons I still don't understand because I'm too old.
If you don't want to listen to them, like me, you can have three different entry points on your back-end, and load a different Javascript file for each.
For structure I would use the following:
- /js/components/common/
- /js/components/containers/
- /js/components/shared/
- /js/app.js
- /js/bootstrap.js
- /js/vue-app.js
The way these works is anything in the common folder is automatically loaded, it is used across the entire application by default. Use this bit of code in app.js
const files = require.context('./components/common/', true, /\.vue$/i);
files.keys().map(key => Vue.component('App' + key.split('/').pop().split('.')[0], files(key).default));
and if you have a file in the "common" folder that looks like this: BigButton.vue it will be usable in your entire application by <app-big-button></app-big-button>. Change the syntax flavour however you like but I like having the 'app-' in front to know that it is global.
The containers folder has a folder for each application "human-resources", "safety" and "project-management" and each has a .js file with all of the specific Vue components used only for those applications. Basically just a big list of imports like this Vue.component('my-hr-component', require('./hr/Person.vue').default)
Use shared for anything that you may import as required which may be shared across some (but not all) applications. Like, say you had a safety chart that also appears on a human resources profile or something. Just an idea, it's totally up to you if you use this idea.
For webpack, I use Laravel Mix, so I don't know how helpful showing a solution there is but here's how I would do it for our example:
mix.js('resources/js/app.js', 'public/js')
.js('resources/js/vue-app.js', 'public/js')
.js('resources/js/components/containers/human-resources.js', 'public/js/human-resources.js')
.js('resources/js/components/containers/safety.js', 'public/js/safety.js')
.js('resources/js/components/containers/project-management.js', 'public/js/project-management.js');
This approach will probably have a better solution. A long time ago it was discussed here: https://laracasts.com/discuss/channels/vue/how-to-organisestructure-all-vue-components
You could probably find a better solution there.