fix(bridge-vue3): pass hashRoute/memoryRoute to RemoteApp and fix path normalization#4551
Conversation
- Add hashRoute mode with basename prefix support in processRoutes - Fix incorrect deprecation message in createRemoteComponent - Update devDependencies: vite-plugin-dts, vue, vue-tsc - Add comprehensive route processing tests
…shRoute mode - Fix addBasenameToNestedRoutes to join paths with '/' separator instead of direct concatenation - Add redirect prefixing support for string and object redirects in addBasenameToNestedRoutes - Add unit tests for hashRoute, memoryRoute, default web history, and redirect handling
🦋 Changeset detectedLatest commit: b51f930 The changes in this PR will be included in the next version bump. This PR includes changesets to release 45 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 project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 361ab3551d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
… paths - Extract prefixPath helper to centralize join + normalize logic - Preserve intentional trailing slashes in paths and redirects (strict mode compat) - Add tests for trailing slash preservation in hashRoute with basename
|
need to resolve conflict |
|
Branch synced with latest main — merge conflict in pnpm-lock.yml has been resolved. Ready for review. @2heal1 |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/data-prefetch
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
Bundle Size Report16 package(s) changed, 24 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 6.31 MB (+5.9 kB (+0.1%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
Description
createRemoteAppComponentinvue3-bridge/src/create.tsacceptedhashRouteandmemoryRouteas part of its type definitions and they were fully implemented downstream (RemoteApp,provider.ts,processRoutes), but theh(RemoteApp, {...})call never forwarded them — so they were alwaysundefinedat runtime.Additionally,
addBasenameToNestedRoutesinrouteUtils.tshad two bugs:basename + route.pathproduced/appprofileinstead of/app/profilefor relative child paths.redirect: '/dashboard'were not prefixed with the basename, causing the remote app to redirect outside its scope (e.g./#/dashboardinstead of/#/barber/dashboard).Changes
create.ts: ForwardhashRouteandmemoryRoutefromcreateRemoteAppComponentoptions to theRemoteAppcomponent viah().routeUtils.ts: Fix path joining with/separator + normalize double slashes. Add redirect prefixing for both string and object redirects.routeUtils.test.ts: Add 13 new unit tests covering hashRoute, memoryRoute, default web history, and redirect handling (24 total).Usage example
Host app (Vue 3 + hash routing):
Remote app (exported via bridge, no changes needed):
Where the remote's router is:
What happens at runtime:
http://localhost:3000/#/barbercreate.tsauto-detectsbasename = '/barber'from the matched routeprocessRoutesreceiveshashRoute: true+basename: '/barber'→ createscreateWebHashHistory()and prefixes all route paths and redirects with/barber{ path: '/', redirect: '/dashboard' }becomes{ path: '/barber', redirect: '/barber/dashboard' }http://localhost:3000/#/barber/dashboardDemo
2026-03-15.11-27-36.mp4
Related Issue
No existing issue — discovered that
createRemoteAppComponentsilently droppedhashRouteandmemoryRouteparams despite them being defined inProviderParamsand fully implemented inprocessRoutes.Related Discussion
#4298
Types of changes
Checklist