fix(bridge-react): wrap react-router-dom path resolve with try catch#3232
fix(bridge-react): wrap react-router-dom path resolve with try catch#3232
Conversation
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
🦋 Changeset detectedLatest commit: 3aa965b The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 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 |
There was a problem hiding this comment.
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-dompath resolution in a try-catch block in the following files:packages/bridge/bridge-react-webpack-plugin/src/utis.tspackages/bridge/bridge-react/src/router-v5.tsxpackages/bridge/bridge-react/src/router-v6.tsxpackages/bridge/bridge-react/src/utils.ts
- Simplify the logic for determining the
reactRouterDomPathvariable inpackages/bridge/bridge-react-webpack-plugin/src/utis.ts - Read the package.json content directly from the resolved path instead of relying on the
findPackageJsonfunction inpackages/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. |
Description
fix(bridge-react): wrap react-router-dom path resolve with try catch
Related Issue
Types of changes
Checklist