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

feat: support react-native #2812

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

Conversation

jbroma
Copy link
Contributor

@jbroma jbroma commented Jul 30, 2024

Description

  • - added separate loadScript and createScript methods for React Native
  • - added checks for node and RN environment
  • - unified CreateScriptHook typing

in node env we check for process.versions.node (source)
in RN we check for global.navigator which is set during initialisation of React Native core (source)

right now the whole loading process is handled internally through Re.Pack

Related Issue

#2811

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

changeset-bot bot commented Jul 30, 2024

⚠️ No Changeset found

Latest commit: 00bd6ea

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

Copy link

netlify bot commented Jul 30, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 00bd6ea
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/66bdb5dcbb48be0008d1c2e8
😎 Deploy Preview https://deploy-preview-2812--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.

@jbroma jbroma marked this pull request as ready for review July 30, 2024 17:45
@@ -32,7 +32,7 @@ class Module {
const remoteEntryExports = await getRemoteEntry({
remoteInfo: this.remoteInfo,
remoteEntryExports: this.remoteEntryExports,
createScriptHook: (url: string, attrs: any) => {
createScriptHook: (url, attrs) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

was this because we have a implicit dependency ts lint rule? if not why were the typings dropped?

Copy link
Contributor Author

@jbroma jbroma Jul 31, 2024

Choose a reason for hiding this comment

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

typing comes from getRemoteEntry type which was modified now, so these typings became redundant

@2heal1
Copy link
Member

2heal1 commented Aug 1, 2024

The runtime and sdk unit test failed and need to be fixed.
You can execute the follow scripts to reproduce:

  • nx test runtime
  • nx test sdk

@jbroma
Copy link
Contributor Author

jbroma commented Aug 1, 2024

@2heal1 tests fixed 🎉

I've added a more strict check for node env to account for that.

@2heal1
Copy link
Member

2heal1 commented Aug 5, 2024

The content is no problem , but i think we should put the loadEntry into hook in case of the runtime code size become bigger with the more target supports .

For my thought , we can add a loaderHook named like loadEntry . And split getRemoteEntry into different runtime plugins which will call loadEntry hook .

Can you help to implement this ? If not, I will implement it next week and then merge this pr .

@jbroma
Copy link
Contributor Author

jbroma commented Aug 5, 2024

The content is no problem , but i think we should put the loadEntry into hook in case of the runtime code size become bigger with the more target supports .

For my thought , we can add a loaderHook named like loadEntry . And split getRemoteEntry into different runtime plugins which will call loadEntry hook .

Can you help to implement this ? If not, I will implement it next week and then merge this pr .

Sure thing! What's the correct place for these runtime plugins to exist in the repo? Do we keep them in SDK?

@2heal1
Copy link
Member

2heal1 commented Aug 5, 2024

The content is no problem , but i think we should put the loadEntry into hook in case of the runtime code size become bigger with the more target supports .
For my thought , we can add a loaderHook named like loadEntry . And split getRemoteEntry into different runtime plugins which will call loadEntry hook .
Can you help to implement this ? If not, I will implement it next week and then merge this pr .

Sure thing! What's the correct place for these runtime plugins to exist in the repo? Do we keep them in SDK?

Much appreciate ! The plugin can be placed in runtime/plugins and re-export as subpath

Copy link
Contributor

github-actions bot commented Nov 3, 2024

Stale pull request message

@ScriptedAlchemy
Copy link
Member

Bump

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.

4 participants