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.2 stopped stating up module federation remote when configured dynamically via manifest file #20000

Closed
1 of 4 tasks
ArgV04 opened this issue Nov 2, 2023 · 2 comments
Closed
1 of 4 tasks

Comments

@ArgV04
Copy link

ArgV04 commented Nov 2, 2023

Current Behavior

I updated from Nx 17.0.2. Before update we started our app with nx serve shell and all module federation remotes automatically started. The were provided via manifest file.

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

Relates to this issue too, I think: #19812 (comment)

This issue I think can be found here:

@nx/webpack/src/utils/module-federation/get-remotes-for-host.js ... new file introduced in Nx 17

There is a method called: extractRemoteProjectsFromConfig

const remotes = [];
....
if (
        Object.keys(parsedManifest).every(
          (key) =>
            typeof key === 'string' && typeof parsedManifest[key] === 'string'
        )
      ) {
        remotes.push(...Object.keys(parsedManifest));
      }

As a result we are now having an array element in the remotes array object pushed.

Later in the main method there: getRemotes .. you are doing something like this :)

remotes.forEach((r) => collectRemoteProjects(r, collectedRemotes, context));

The collectRemoteProjects now get an array as first parameter r and trying to resolve the remote name in its method

const remoteProject = context.projectGraph.nodes[remote]?.data;

But the remote is not some kind of string. It's the array of key names itself from the manifest file and returning undefined!

Bähmm :)

Please fix :)

Expected Behavior

Serving host should automatically work like in Nx 16.x

GitHub Repo

No response

Steps to Reproduce

  1. nx serve shell-app (created with --dynamic)

Nx Report

Node   : 18.14.0
   OS     : win32-x64
   yarn   : 3.2.4

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

Failure Logs

No response

Package Manager Version

npm 9.8.1

Operating System

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

Additional Information

No response

@Coly010
Copy link
Contributor

Coly010 commented Nov 2, 2023

It's been fixed by this: #19894

@Coly010 Coly010 closed this as completed Nov 2, 2023
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.
Projects
None yet
Development

No branches or pull requests

2 participants