single-spa-portal-example icon indicating copy to clipboard operation
single-spa-portal-example copied to clipboard

VueJS router project

Open egoisticum opened this issue 6 years ago • 17 comments

Hello guys,

first of all have to say that single-spa seems gr8 work for me and my team needs.

However, we play a lot with VueJS and want to combine it with single-spa so we can make our project attractive for more other javascript developers such as Angular, React, etc...

The thing is, we already have monolith application written in VueJS which behave very nice but we are not experts enough to port it into single-spa. Our issue is as title says use of VueJS router.

Let's be honest and confess that application is pretty useless if we can't use router there.

Since we struggle about this few days we pushed project on this repository https://github.com/egoisticum/single-spa-vue-router so somebody can help us.

What we did is basic:

  1. Forked single-spa-portal-example repo
  2. Removed all other applications except Vue one
  3. Put some dummy content and routes into Vue project

We tried to make any VueRouter configuration possibility and tested it but without success.

Also, followed the instructions from this discussion https://github.com/CanopyTax/single-spa/issues/228 but nothing made it work for our project.

Can't wait to see community suggestions or some commits on our repository.

BTW I mentioned you guys doesn't have to much Vue lowers in your team and that you seek for it. So, maybe this project can be cool playground for all VueJS folks which are interested in single-spa and we as a team are eager to make much more examples Vue based just after we make vue router works.

Thanks in advance.

egoisticum avatar Oct 25 '18 07:10 egoisticum

Following - Stuck in a similar situation while working with VueRouter. Would appreciate any suggestions on this.

hari-h avatar Oct 25 '18 07:10 hari-h

same problem here.

malanoga avatar Oct 25 '18 08:10 malanoga

Exactly the same issue happened to me. Nevertheless, when I load the app by itself (standalone run and build) it works just fine. But still stuck on the global run of the app. Hope someone can help with this, it's been few days since I'm stuck on this...

tariktuzlakovic avatar Oct 25 '18 09:10 tariktuzlakovic

Any fixes for this?

kresic-ivan-nsoft avatar Oct 25 '18 10:10 kresic-ivan-nsoft

Encountered the same issue..

edinlonic avatar Oct 25 '18 10:10 edinlonic

This is a blocker for us as well, router is a key part for us, would appreciate a fix here.

unm4sk1g avatar Oct 25 '18 11:10 unm4sk1g

Made it work on very primitve way by simply importing other components https://github.com/egoisticum/single-spa-vue-router/commit/d24f184603b7263f3eba7dfbe4c84f42e6c0e712

However, please don't just close this issue until we find out better approach. Also, contributors of single-spa can approach here with some ideas and vision how we gonna make this example application much more useful for community.

egoisticum avatar Oct 25 '18 13:10 egoisticum

I'm interested in this subject as well. Any progresses so far?

fergardi avatar Nov 26 '18 14:11 fergardi

@fergardi here you go https://github.com/egoisticum/single-spa-portal-example-vue-example I forked single-spa-portal-example and did some vue magic such as router handling and redux state implementation. Feel free to join to expand this example even more. ;)

egoisticum avatar Nov 27 '18 08:11 egoisticum

Thanks @egoisticum for the fork. I'm gonna try it right away!

However, I'm still in doubt of how this will work in production. Let's say you compile a production build of a Vue app, as well as the Single SPA Portal app. Then how do you link the compiled Vue app into the Portal? I mean, in the singleSpaEntry.js there are references to the ./App.vue file, but not at all to the compiled dist folder. Does this means that this solution only works with non compiled, in development projects?

What I am trying to achieve here is this scenario:

  • Compiled Portal in production mode (either made with VueJS, Angular, React, whatever framework I choose)
  • Compiled VueJS App1 as a standalone application, mounted in real-time by the Portal, accesible by a defined route.
  • Compiled Angular App2 as a standalone application, mounted in real-time by the Portal, accesible by a defined route.

This way, our App1 team can work in their own repository, republish the app to a pre-stablished production folder, and the Portal will still be able to found it and mount it in real-time. The Portal team and the App2 team will not be interrupted by this release, and for the end user it will be transparent as well.

Thanks in advance.

fergardi avatar Nov 27 '18 13:11 fergardi

Nevermind, I now understand the procedure completely. Thank you all. However, @egoisticum, I could not make the vue app work in watch:standalone mode with the router working. It gaves me this error:

image

Thank you.

fergardi avatar Nov 27 '18 16:11 fergardi

This is great because you understand it. My team situation is that we have only VueJS developers one portal app which is also Vue solution and 3 child again VueJS applications. It's great because we can use our lovely framework but still can be opened for new developers who will come with our startup business success. So, if you're or some of your team members are eager to contribute feel free to approach to see if we can organise some virtual open-source team who can help to community but ourselves as well with knowledge sharing about this pretty not well documented project.

egoisticum avatar Nov 28 '18 08:11 egoisticum

@egoisticum can you build the Portal app using some framework like VueJS as well as the micro apps? How can you do that? Can you show me an example of the Portal being a VueJS app?

Thank you in advance.

fergardi avatar Nov 28 '18 16:11 fergardi

The philosophy is very simple:

  1. Leave whole portal code as it is.
  2. Add VueJS into portal project
  3. Do VueJS instantiation after portal stuff finish.

Just spend on this one couple of hours if not make some success I'll update my single-spa-portal-example fork during the weekend days.

egoisticum avatar Nov 29 '18 10:11 egoisticum

@egoisticum thanks for your help. Unfortunately, I have not been able to make it work.

fergardi avatar Nov 30 '18 11:11 fergardi

Hi egoisticum,

Sorry not sure if I could really understand the issue! I just ran single-spa-portal having portal and vue app after changing the routes as of yours from single-spa-vue-router and it worked fine. I even added one more route and it also ran fine. Could you please clarify what issue you have here?

Updates: I tried to run standalone and it still worked fine there so probably I couldn't get what the issue is?

Updates: I also tried https://github.com/egoisticum/single-spa-portal-example-vue-example and all went well

amit131 avatar Dec 07 '18 17:12 amit131

The philosophy is very simple:

  1. Leave whole portal code as it is.
  2. Add VueJS into portal project
  3. Do VueJS instantiation after portal stuff finish.

Just spend on this one couple of hours if not make some success I'll update my single-spa-portal-example fork during the weekend days.

Have you solved this problem? and, Is your error message this? @egoisticum 2019-02-13 7 35 52 thanks

resourceF avatar Feb 13 '19 11:02 resourceF