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

Throw error on build if 'name' in Module Federation config does not match a project name #15686

Closed
1 task
pcurrivan opened this issue Mar 15, 2023 · 1 comment · Fixed by #15694
Closed
1 task
Assignees
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug

Comments

@pcurrivan
Copy link

Description

The name field in module-federation.config.js is used to search the project dependency graph to find project dependencies, which are used to generate shared module configuration for webpack. If the name does not match a project name, currently an empty set of dependencies is returned without error, resulting in no libraries being configured for sharing. Instead, an error should be thrown.

Motivation

This will enforce that the name field must match a project name and prevent hard-to-debug module federation issues.

Suggested Implementation

In getModuleFederationConfig, before calling getDependentPackagesForProject, check if mfConfig.name is a key in the projectGraph. If not, throw an error and abort the build.

@github-actions
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 Apr 15, 2023
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 type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants