Skip to content

feat: scaffold TanStack Module Federation plugin - #1

Open
Nsttt wants to merge 5 commits into
mainfrom
feat/tanstack-module-federation-scaffold
Open

Nsttt wants to merge 5 commits into
mainfrom
feat/tanstack-module-federation-scaffold

Conversation

@Nsttt

@Nsttt Nsttt commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Prepare this repository to publish @module-federation/tanstack for TanStack Start on Vite and Rsbuild/Rspack. The package now isolates each bundler adapter behind its own export and uses optional peer dependencies, so a project only installs and resolves the Module Federation plugin for its bundler.

Rslib builds conditional ESM and CommonJS outputs with matching declarations. Four runnable TanStack Start applications exercise Vite, Rsbuild, same-bundler federation, and reciprocal client-side manifest interoperability.

Changes

  • add the backward-compatible root and /vite adapter using @module-federation/vite
  • add /rsbuild using @module-federation/rsbuild-plugin, with browser script/JSONP compatibility and optional async-node CommonJS SSR output
  • default Rsbuild React and React DOM shares to eager singletons while preserving explicit overrides and caller immutability
  • replace tsdown with Rslib and publish .js/.d.ts ESM plus .cjs/.d.cts CommonJS artifacts
  • model Vite, Rsbuild, and both Module Federation adapters as isolated optional peers
  • name the Vite pair apps/vite-host and apps/vite-remote, alongside the new
    Rsbuild/Rspack host and remote apps
  • wire each host to both remote formats through manifests, with browser-only cross-bundler loading
  • verify manifests, entries, exposed CSS/types, package contents, compiler hooks, clean-consumer resolution, and live four-app HTTP startup
  • document the remaining same-bundler and cross-bundler SSR work in TODO.md
  • retain Changesets, preview publishing, semantic PR validation, and serialized trusted npm publishing

Testing

  • pnpm install --frozen-lockfile
  • pnpm format:check
  • pnpm exec tsc -b --force --pretty false
  • pnpm typecheck
  • pnpm test (22 tests, including live Vite/Rsbuild runtime shells)
  • pnpm pack:tanstack
  • actionlint
  • docs-list
  • git diff --check
  • Codex autoreview: clean final pass

Review notes

Accepted findings fixed during review: remote loader stale state, Vite hydration mismatch, and preserving ESM filenames when CommonJS forcing is disabled.

Two findings were rejected with direct build evidence: Rslib 1.0.1 accepts the --lib esm and --lib cjs selectors used here, and Rsbuild's environment-scoped Module Federation instances produce both browser and SSR manifests despite sharing the upstream plugin name.

Follow-up

Follow TODO.md for the Rsbuild SSR fixture, cross-bundler server-entry transport,
shared React identity, outage recovery, and version matrix. The current examples
and tests claim client manifest interoperability only, not cross-bundler SSR
remote rendering.

@pkg-pr-new

pkg-pr-new Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/module-federation/tanstack/@module-federation/tanstack@1

commit: c73cf94

@Nsttt Nsttt self-assigned this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant