docs: fix non-existent bridge-react/react import path - #4971
docs: fix non-existent bridge-react/react import path#4971Gmendesfonseca wants to merge 2 commits into
bridge-react/react import path#4971Conversation
The Producer and Consumer API tables in the React Bridge getting-started
guide point at `@module-federation/bridge-react/react`. That subpath is not
in the package's `exports` map and never has been, so the import fails to
resolve:
$ node -e "require.resolve('@module-federation/bridge-react/react')"
MODULE_NOT_FOUND
The correct entry for the legacy (React 16/17) `createBridgeComponent`, for
`createRemoteAppComponent` and for `lazyLoadComponentPlugin` is the package
root, which is what `apps/router-demo` and the sibling `load-app` /
`export-app` guides already use.
Replaces all 9 occurrences across en, zh and pt-BR.
|
|
Thanks for fixing the invalid @module-federation/bridge-react/react paths. The root entry is correct for createBridgeComponent (React 16/17) and createRemoteAppComponent. For lazyLoadComponentPlugin, could we use its dedicated public entry instead? import { lazyLoadComponentPlugin } from '@module-federation/bridge-react/lazy-load-component-plugin'; The package root currently includes the router-aware component implementation and therefore resolves the optional react-router-dom peer dependency. The dedicated entry avoids that router This investigation also highlighted an issue in our current entry-point design: importing an unrelated API from the package root can unexpectedly bring in router dependencies. We are aware For this PR, please update the corresponding row in all three locales to: @module-federation/bridge-react/lazy-load-component-plugin |
The Consumer API table listed the package root as the import path for lazyLoadComponentPlugin. The root re-exports createRemoteAppComponent from ./remote/router-component, so importing the plugin from there pulls in the optional react-router-dom peer. The dedicated ./lazy-load-component-plugin entry only depends on ../lazy and @module-federation/runtime.
46264c8 to
cc4d431
Compare
|
@2heal1 Thanks — updated in all three locales (en, zh, pt-BR), pushed as cc4d431. The Consumer API row for lazyLoadComponentPlugin now reads:
Your reasoning checks out against the source: the root src/index.ts re-exports
One thing worth flagging for the entry-point follow-up you mentioned: the getting-started table is now the only place in the docs that points at the dedicated entry.
|
Description
The Producer API and Consumer API tables in the React Bridge getting-started guide point readers at
@module-federation/bridge-react/react. That subpath is not in the package'sexportsmap, so an import copied from these tables fails to resolve:git log -S'"./react"' -- packages/bridge/bridge-react/package.jsonreturns no commits, so this is a path that never existed rather than one that was removed and needs restoring. Neither of the two open PRs that modify thatexportsmap (#4837, #4869) adds it.The correct entry point for the legacy (React 16/17)
createBridgeComponent, forcreateRemoteAppComponentand forlazyLoadComponentPluginis the package root:apps/router-demouses the package root for all six of itscreateBridgeComponent/createRemoteAppComponentimports, and/v18,/v19and/pluginfor the rest./reactappears zero times.load-app.mdxandexport-app.mdxguides already use the package root in their code samples.So the getting-started tables currently contradict both the working examples and the neighbouring pages. A reader following the entry-point tables — the first concrete instruction on the page — hits a module resolution error before anything else.
This PR replaces all 9 occurrences across the English, Simplified Chinese and Brazilian Portuguese pages.
This is a documentation-only change. It does not change runtime behavior or the public API.
Validation
prettier --check apps/website-new/docs/{en,zh,pt-BR}/guide/bridge/react/getting-started.mdx— all matched files use Prettier code styleRelated Issue
N/A — documentation-only correction.
Types of changes
Checklist