Skip to content
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

fix(bridge-react): wrap react-router-dom path resolve with try catch #3232

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

danpeen
Copy link
Contributor

@danpeen danpeen commented Nov 15, 2024

Description

fix(bridge-react): wrap react-router-dom path resolve with try catch

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Copy link

netlify bot commented Nov 15, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit be577f7
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/6736e72fea071000083c5f34
😎 Deploy Preview https://deploy-preview-3232--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 site configuration.

Copy link

changeset-bot bot commented Nov 15, 2024

🦋 Changeset detected

Latest commit: 3aa965b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/bridge-react Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/rsbuild-plugin Patch
@module-federation/storybook-addon Patch
@module-federation/modernjsapp Patch
@module-federation/runtime Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/error-codes Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch
website-new Patch

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

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This pull request fixes a bug in the bridge-react package by wrapping the react-router-dom path resolution in a try-catch block. This change ensures more robust handling of routing-related functionality and prevents application crashes during the build process when there are issues with the react-router-dom path resolution.

The key changes include:

  • Wrap react-router-dom path resolution in a try-catch block in the following files:
    • packages/bridge/bridge-react-webpack-plugin/src/utis.ts
    • packages/bridge/bridge-react/src/router-v5.tsx
    • packages/bridge/bridge-react/src/router-v6.tsx
    • packages/bridge/bridge-react/src/utils.ts
  • Simplify the logic for determining the reactRouterDomPath variable in packages/bridge/bridge-react-webpack-plugin/src/utis.ts
  • Read the package.json content directly from the resolved path instead of relying on the findPackageJson function in packages/bridge/bridge-react-webpack-plugin/src/utis.ts

These changes improve the overall reliability and robustness of the bridge-react package by handling potential errors during the build process.

File Summaries
File Summary
packages/bridge/bridge-react-webpack-plugin/src/utis.ts The code changes wrap the react-router-dom path resolution in a try-catch block to handle potential errors, and simplify the logic for determining the reactRouterDomPath variable. Additionally, the code now reads the package.json content directly from the resolved path instead of relying on the findPackageJson function.
packages/bridge/bridge-react/src/router-v5.tsx The changes in this file involve wrapping the react-router-dom path resolution in a try-catch block to handle potential errors during the build process. This is a bug fix that addresses an issue where directly exporting from react-router-dom/index.js was causing build failures.
packages/bridge/bridge-react/src/router-v6.tsx The changes in this file focus on wrapping the react-router-dom path resolution within a try-catch block to handle potential errors. This is likely a bug fix to ensure more robust handling of routing-related functionality in the bridge-react package.
packages/bridge/bridge-react/src/utils.ts The changes in this file introduce a try-catch block around the react-router-dom path resolution logic to handle potential errors and prevent application crashes. This is a bug fix that enhances the reliability and robustness of the bridge-react package.

@danpeen danpeen merged commit 0309fb5 into main Nov 15, 2024
16 checks passed
@danpeen danpeen deleted the fix/bridge-path-resolve branch November 15, 2024 06:35
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.

2 participants