-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(vue3-bridge): refactor of createBridgeComponent to add the ability to register plugins inside the function #3297
base: main
Are you sure you want to change the base?
Conversation
… createBridgeComponent
🦋 Changeset detectedLatest commit: 6d52726 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hello! When I integrate my remote application into a page, and it has its own routes, browser navigation within the microfrontend works perfectly. But if I navigate to another page in the host application, the browser's "Back" button will not take me back to the remote application. Instead, it will lead to a non-existent page. For example, I have:
When I navigate between
When I navigate to P.S. Vue-router in |
So far, I have only found the issue to be that the remote application has its own base path, such as /module-federation, which is not accounted for in the router. This causes it to be lost in the historyState of the vue-router when navigating back to the host application. In the Vue Router issues, I saw a post where the creator mentions that in such cases, the same createWebHistory instance should be used across routers. I tried this approach, and it actually worked. However, currently, there is no way to pass the createWebHistory instance into createBridgeComponent. Perhaps it would make sense to add this capability, for example, as a parameter returned from addOptions? But how is it better to get the createWebHistory instance from the host application? At the moment, I am passing it using the window object. However, since createBridgeComponent is executed in the context of the host application, perhaps you can suggest a more correct way to do this? |
A small refactor of createBridgeComponent to add the ability to register plugins inside the function.
Description
createBridgeComponent
function.appOptions
so that necessary plugins can be registered in this callback.router
returned fromappOptions
optional.beforeBridgeRenderRes
to be a promise.Types of changes
Checklist
Are we sure that
appOptions
should return the actual instance of the Vue Router rather than just the necessary parameters?In my case, I have to create the router inside the
addOptions
callback to pass it tocreateBridgeComponent
, where another router instance will be created.Maybe we could consider returning something like this from
addOptions
instead: