Skip to content

feat: sink React dependencies and switch to TSC compiler #3919

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ScriptedAlchemy
Copy link
Member

Summary

  • Remove React dependencies from root package.json and move to individual packages that need them
  • Switch rsbuild-plugin and SDK packages from SWC to TSC compiler for better TypeScript compliance
  • Fix React.CSSProperties type resolution issues

Changes Made

React Dependency Management

  • ✅ Removed react, react-dom, react-router-dom, @types/react, @types/react-dom from root package.json
  • ✅ Added React types to packages that need them:
    • packages/modernjs - Added @types/react and @types/react-dom
    • packages/nextjs-mf - Added @types/react and @types/react-dom
    • packages/utilities - Added @types/react and @types/react-dom
    • packages/bridge/bridge-shared - Added @types/react to fix React.CSSProperties usage
    • packages/bridge/vue3-bridge - Added @types/react for bridge-shared dependency

Compiler Changes

  • ✅ Changed packages/rsbuild-plugin/project.json compiler from "swc" to "tsc"
  • ✅ Changed packages/sdk/project.json compiler from "swc" to "tsc"

Test plan

  • Build passes for all affected packages
  • Tests pass for rsbuild-plugin and SDK packages
  • No TypeScript compilation errors
  • Workspace dependencies resolve correctly

Benefits

  • Better monorepo dependency management following best practices
  • Stricter TypeScript compilation with TSC
  • Eliminates legacy TypeScript deprecation warnings
  • Improved type safety and module resolution

🤖 Generated with Claude Code

- Remove React dependencies from root package.json
- Move React dependencies to individual packages that need them
- Add @types/react to packages using React types
- Switch rsbuild-plugin and SDK from SWC to TSC compiler
- Fix React.CSSProperties type resolution in bridge-shared

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

netlify bot commented Jul 16, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 5005754
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6877718aa0dbb90008c4d397
😎 Deploy Preview https://deploy-preview-3919--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

changeset-bot bot commented Jul 16, 2025

⚠️ No Changeset found

Latest commit: 5005754

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

ScriptedAlchemy and others added 6 commits July 16, 2025 01:16
Add TypeScript path mappings and project references to resolve
module federation SDK imports when using TSC instead of SWC.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update @types/react from 18.2.79 to 18.3.11 to resolve
jsx-dev-runtime import issues in tests after React dependencies
were moved from root to individual packages.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update lockfile to reflect @types/react version change
in bridge-react package.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Revert rsbuild-plugin from TSC to SWC compiler as TSC has
module resolution issues with workspace dependencies in the
rollup build process. Keep SDK with TSC as requested.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix jsx-dev-runtime import errors in bridge-react tests
- Convert from Vite test runner to @nx/jest:jest executor
- Add Jest configuration with SWC transformer
- Add React dependency package.json in bridge directory
- Update test imports from vitest to @jest/globals
- Add TextEncoder/TextDecoder polyfills for jsdom
- Configure proper JSX transformation with SWC

This resolves the CI failures where bridge-react tests were failing
due to "Failed to resolve import 'react/jsx-dev-runtime'" errors.
Tests now run successfully with Jest framework.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant