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

17.0.1 stopped stating up module federation remotes #19812

Closed
1 of 4 tasks
rbirkgit opened this issue Oct 23, 2023 · 10 comments
Closed
1 of 4 tasks

17.0.1 stopped stating up module federation remotes #19812

rbirkgit opened this issue Oct 23, 2023 · 10 comments
Assignees
Labels

Comments

@rbirkgit
Copy link

Current Behavior

I updated from Nx 16.9.1 to 17.0.1. Before update we started our app with nx serve myapp and all module federaion remotes automatically started.

After migration to 17.0.1 remotes are no longer started. The console shows this:

 NX  Starting module federation dev-server for myapp with 0 remotes

Expected Behavior

To work as with 16.9.1. I cannot see any breaking changes in the changelog.

GitHub Repo

No response

Steps to Reproduce

nx serve

Nx Report

Node   : 18.14.0
   OS     : win32-x64
   yarn   : 3.2.4

   nx                 : 17.0.1
   @nx/js             : 17.0.1
   @nx/jest           : 17.0.1
   @nx/linter         : 17.0.1
   @nx/eslint         : 17.0.1
   @nx/workspace      : 17.0.1
   @nx/angular        : 17.0.1
   @nx/cypress        : 17.0.1
   @nx/devkit         : 17.0.1
   @nx/eslint-plugin  : 17.0.1
   @nrwl/tao          : 17.0.1
   @nx/web            : 17.0.1
   @nx/webpack        : 17.0.1
   typescript         : 4.9.5
   ---------------------------------------
   Community plugins:
   ng-mocks : 14.11.0

Failure Logs

No response

Package Manager Version

yarn 3.2.4

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@jaysoo jaysoo added the scope: angular Issues related to Angular support in Nx label Oct 24, 2023
@ndcunningham
Copy link
Contributor

ndcunningham commented Oct 24, 2023

Hi, I tried this on my local windows machine:

  1. Install create a Nx workspace and installed angular (v16.9.0)
  2. Ran nx build host & nx serve host to check that they are working
  3. Ran nx migrate latest, to update to the latest version of Nx (v17.0.1)
  4. Re-ran nx build host and nx serve host

There are no breaking changes for module-federation in Nx 17.

Did you run nx migrate to update Nx to the latest version?
Can you show me your host module-federation.config.ts?

@rbirkgit
Copy link
Author

rbirkgit commented Oct 24, 2023

I did run the migration. Here is the module-federation.config.ts file

module.exports = {
  name: 'myapp',
  remotes: [],
};

@ndcunningham
Copy link
Contributor

ndcunningham commented Oct 24, 2023

Your module-federation.config.ts should be similar to this

import { ModuleFederationConfig } from '@nx/webpack';

const config: ModuleFederationConfig = {
  name: 'host',
  remotes: ['remote'], // <--- Add your remotes here
};

export default config;

You need to add your remote name inside of your host module-federation.config.ts in order for it to start those remotes when your serve the host application.
Can you try this and let me know if that worked?

@rbirkgit
Copy link
Author

That made a difference. Strange it worked with 16.9 without the entries.

One difference still seems that now with nx serve it says starting up two remotes, but it doesn't start them in separate ports etc unless I also add --devRemotes xxx With 16.9 we didn't need to.

@rbirkgit
Copy link
Author

The Nx 17 release notes says Enhancements to Module Federation Support but I cannot find what that is. May be related.

@ndcunningham
Copy link
Contributor

ndcunningham commented Oct 24, 2023

That made a difference. Strange it worked with 16.9 without the entries.

One difference still seems that now with nx serve it says starting up two remotes, but it doesn't start them in separate ports etc unless I also add --devRemotes xxx With 16.9 we didn't need to.

If you list your remote inside of your host module-federation.config.ts they should be started statically on separate ports.
For example:

--devRemotes starts the remotes in dev mode, i.e. watches for file changes and updates the UI with the changes.
https://nx.dev/nx-api/react/executors/module-federation-dev-server#devremotes

@rbirkgit
Copy link
Author

Thanks for the help and solution.

Strange that it all worked with 16.9 and broke with 17.0 so something changed with latest version.

@ArgV04
Copy link

ArgV04 commented Nov 2, 2023

Current Behavior

I updated from Nx 16.9.1 to 17.0.1. Before update we started our app with nx serve myapp and all module federaion remotes automatically started.

After migration to 17.0.1 remotes are no longer started. The console shows this:

 NX  Starting module federation dev-server for myapp with 0 remotes

Expected Behavior

To work as with 16.9.1. I cannot see any breaking changes in the changelog.

GitHub Repo

No response

Steps to Reproduce

nx serve

Nx Report

Node   : 18.14.0
   OS     : win32-x64
   yarn   : 3.2.4

   nx                 : 17.0.1
   @nx/js             : 17.0.1
   @nx/jest           : 17.0.1
   @nx/linter         : 17.0.1
   @nx/eslint         : 17.0.1
   @nx/workspace      : 17.0.1
   @nx/angular        : 17.0.1
   @nx/cypress        : 17.0.1
   @nx/devkit         : 17.0.1
   @nx/eslint-plugin  : 17.0.1
   @nrwl/tao          : 17.0.1
   @nx/web            : 17.0.1
   @nx/webpack        : 17.0.1
   typescript         : 4.9.5
   ---------------------------------------
   Community plugins:
   ng-mocks : 14.11.0

Failure Logs

No response

Package Manager Version

yarn 3.2.4

Operating System

  • macOS
  • Linux
  • [] Windows
  • Other (Please specify)

Additional Information

No response

This issue still happen, when remotes are configured dynamically with manifest file. now with Nx 17 the remotes are not detected anymore and not served too.

@Coly010
Copy link
Contributor

Coly010 commented Nov 2, 2023

Fixed by this: #19894

Copy link

github-actions bot commented Dec 3, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants