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(react): Support loading remotes via library: var #19192

Merged

Conversation

ndcunningham
Copy link
Contributor

This PR updates withModuleFederation plugin for React apps to now support library: { type: 'var' } when loading remotes.

With this change, users can now decorate their hosts and remotes with library: { type: 'var'}, enabling the remote to be loaded via script.

To enable this type of loading you would need to update your host and remote similar to this:

// host module-federation.config.js
module.exports = {
  library: { type: 'var', name: 'host' },
  //... Other host config
};
// remote module-federation.config.js
module.exports = {
  library: { type: 'var', name: 'remote' },
  //... Other remote config
};

@vercel
Copy link

vercel bot commented Sep 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2023 2:32pm

@ndcunningham ndcunningham force-pushed the feat/module-federation-lib-type-update branch from eca8fe3 to 5739faf Compare September 15, 2023 16:06
@ndcunningham ndcunningham self-assigned this Sep 15, 2023
@ndcunningham ndcunningham added the scope: react Issues related to React support for Nx label Sep 15, 2023
Copy link
Contributor

@Coly010 Coly010 left a comment

Choose a reason for hiding this comment

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

Left one comment, but overall looks good!!

Can we also make sure this is added to Angular?

it('should navigate to /about from /', () => {
cy.get('a').contains('${remote}').click();
cy.url().should('include', '/${remote}');
getGreeting().contains('Welcome ${remote}');
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to be an error with this function, do you need to import it?

@ndcunningham ndcunningham force-pushed the feat/module-federation-lib-type-update branch 2 times, most recently from c03fa73 to d07a40d Compare September 18, 2023 15:10
@ndcunningham ndcunningham force-pushed the feat/module-federation-lib-type-update branch 2 times, most recently from 794e193 to 72fa61f Compare September 18, 2023 17:48
@ndcunningham ndcunningham enabled auto-merge (squash) September 18, 2023 17:49
@ndcunningham
Copy link
Contributor Author

Left one comment, but overall looks good!!

Can we also make sure this is added to Angular?

We could add a task for angular all that would be needed is to update the with-module-federation and add a e2e

@ndcunningham ndcunningham force-pushed the feat/module-federation-lib-type-update branch 3 times, most recently from e06d3ef to 7771472 Compare September 18, 2023 19:18
@ndcunningham ndcunningham force-pushed the feat/module-federation-lib-type-update branch from 7771472 to f220342 Compare September 19, 2023 14:32
@ndcunningham ndcunningham merged commit 0369224 into nrwl:master Sep 19, 2023
15 checks passed
@ndcunningham ndcunningham deleted the feat/module-federation-lib-type-update branch September 19, 2023 15:15
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: react Issues related to React support for Nx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants