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

Production build (shell app) does not build remotes apps via host app build #26944

Closed
1 of 4 tasks
pawelofieldly opened this issue Jul 16, 2024 · 7 comments
Closed
1 of 4 tasks
Assignees
Labels
outdated scope: angular Issues related to Angular support in Nx scope: module federation Issues related to module federation support type: bug

Comments

@pawelofieldly
Copy link

Current Behavior

I have migrated nx 18 -> 19 and I noticed that remotes apps are not built up. My project is created by module federation config. Previously it was enough to run nx run shellapp:build to build the shell project and remote apps at once time. Now I have to run remote:build separately for each remote. I've tried it by create new empty workspace project and setup MF from scratch as it's described in documentation. It also fails. Is it bug or a feature ?

Expected Behavior

Build remote apps together with shell app

GitHub Repo

No response

Steps to Reproduce

  1. Create empty folder
  2. setup project as in documentation: nx g @nx/angular:host shell --directory=apps/angular/with-remotes/shell --remotes=remote1,remote2 https://nx.dev/recipes/module-federation/create-a-host
  3. nx run shell:build

I've also added "implicitDependencies": ["remote1", "remote2"], it ends up succeeded but remotes apps are still not built up as in nx18

Nx Report

Node   : 20.15.0
OS     : darwin-arm64
npm    : 10.7.0

nx                 : 19.4.3
@nx/js             : 19.4.3
@nx/jest           : 19.4.3
@nx/linter         : 19.4.3
@nx/eslint         : 19.4.3
@nx/workspace      : 19.4.3
@nx/angular        : 19.4.3
@nx/devkit         : 19.4.3
@nx/eslint-plugin  : 19.4.3
@nrwl/tao          : 19.4.3
@nx/web            : 19.4.3
@nx/webpack        : 19.4.3
typescript         : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

No response

@FrozenPandaz FrozenPandaz added scope: angular Issues related to Angular support in Nx scope: module federation Issues related to module federation support labels Jul 16, 2024
@Coly010
Copy link
Contributor

Coly010 commented Jul 19, 2024

The implicitDependencies are required to inform Nx to build other projects first.

If that is missing, then Nx will not know to build the remotes.

It is intentionally not added when generating hosts with remotes to support independent deployability of remote applications

@Coly010 Coly010 closed this as completed Jul 19, 2024
@pawelofieldly
Copy link
Author

@Coly010 I've added implicit dependencies (as I mention :)) and it doesn't work as well. I've added it to the shell project.json

@Coly010
Copy link
Contributor

Coly010 commented Jul 19, 2024

@pawelofieldly Ah yes, in that case your nx.json is missing the following in targetDefaults

"build": {
   "dependsOn": ["^build"]
}

@pawelofieldly
Copy link
Author

@Coly010 Thanks, it seems that my project builds up properly now :)

@EnochGao
Copy link

Has the issue been fixed? Why do I still have this problem?
#27448

@EnochGao
Copy link

@Coly010

Copy link

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 Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: angular Issues related to Angular support in Nx scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

No branches or pull requests

4 participants