MtDalPizzol / laravel-inertia-vue-cli

Integrate Laravel and Inertia.js with a Vue CLI app
4 stars 2 forks source link

Having 2 frontend apps, with different versions #1

Open ijpatricio opened 2 years ago

ijpatricio commented 2 years ago

Hi Matheus!

I like this way of thinking! Thank you for this; you saved me a ton of work!! I went to learn deeper about Webpack, and this is not a straight-up solution!

I've done an initial project and will be open-source for the website of Laravel-Portugal (laravel.pt) I want to achieve a solution with two different apps on the Frontend. In this case, Vue2 (Vuetify) and Vue3 (tailwind). Because of this, I could not leverage the multi page/entries.

I'm going to make a live session on youtube coding the website, and I would like to give you the proper credits and a big shoutout! Of course, I will do it to the DEV.to articles, and I would like to know if you also have a Twitter handle I can share?

Also would love to invite you and have you on, discuss a little, and share insights!

Here is the channel: https://www.youtube.com/channel/UCTVujeJyggsTZnlnsdaP0dQ My Twitter: https://twitter.com/ijpatricio

Let me know what you think?

MtDalPizzol commented 2 years ago

I @ijpatricio , Sorry for the LOOOOONG delay to respond to this. I was not used to get people carrying for my work here at all. =P

If you need completely different setups for admin, front-end or whatever other endpoint you need, in theory you could simply do this:

1. Add an entry to your vue.config.js.

 pages: {
    ...page('main', 'app'),
    ...page('admin', `admin`),
  },

2. Create the entry file at resources/src/admin.js.

3. Tell Inertia which rootView to use when rendering admin pages.

return Inertia::setRootView('admin')->render('admin/Dashboard');

Chaining the setRootView method is available since inertia-laravel v0.4.4. For previous versions you need to do this in 2 lines:

Inertia::setRootView('admin');

return Inertia::render('admin/Dashboard');

Again, I'm really sorry for the delay. If you need any further help, don't hesitate to message me.