Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📦 Pull Request
Following the Magic SDK integration into Redwood JS, an issue in our approach to multi-platform support (Web + React Native) became abundantly clear: TypeScript is highly limited in its flexibility with regards to global type definitions. Basically, TypeScript expects each NPM module to contain one, environment-specific package.
If a developer imports any NPM package that contains a reference to, or dependency upon some global types, those types are pulled in—regardless of the project’s requirements. This was causing a bug where React Native types would conflict with DOM types even if only the Web bundle is imported.
This issue was not commonly encountered because developers are largely making use of Webpack to bundle Magic SDK with their applications. The Redwood JS integration was the first time a developer attempted to wrap our package within another NPM module, leading to a TypeScript compiler error. At the moment, the issue is mitigated by disabling React Native typings within Magic SDK, but this is unsatisfactory in the long-term. A preferable approach is to distribute React Native-compatible code as a separate NPM package. This is a breaking change, but I think it’s worth doing to prevent future headaches.
The following packages would be published under this new monorepo architecture:
@magic-sdk/[email protected]
@magic-sdk/[email protected]
@magic-sdk/[email protected]
[email protected]
🗜 Versioning
(Check one!)
✅ Fixed Issues
🚨 Test instructions
yarn build
thenyarn test
CHANGELOG.md
Upcoming Changes
section ofCHANGELOG.md
with context related to this Pull Request.