Skip to content

fix(native-federation): Fix failing build caused by concurrent access to externals metadata. - #1058

Merged
Aukevanoost merged 2 commits into
angular-architects:mainfrom
fzankl:main
Feb 6, 2026
Merged

fix(native-federation): Fix failing build caused by concurrent access to externals metadata.#1058
Aukevanoost merged 2 commits into
angular-architects:mainfrom
fzankl:main

Conversation

@fzankl

@fzankl fzankl commented Feb 6, 2026

Copy link
Copy Markdown

Summary

The externals metadata are stored individually for each native federation build to prevent build errors.

Context

When running applications using e.g. concurrently "ng serve mfe1" "ng serve mfe2" "ng serve mfe3" "ng serve vnf-host" the host and all micro frontends are built and launched in parallel. Hence, externals metadata files are also processed in parallel.

Since the applications use the same dependency stack, different processes access the same files, which can result in empty files or exceptions such as EBUSY: resource busy or locked.

To avoid build errors, the externals metadata files should be processed and stored separately for each build.

@Aukevanoost Aukevanoost left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this! I have one small feedback point.

const usedPackageNamesWithTransient = addTransientDeps(
usedPackageNames,
workspaceRoot,
config.name

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is unfortunately optional and can be empty, could you make the fallback consistent with the behavior in externals caching?

https://github.com/angular-architects/module-federation-plugin/blob/a61e3f1899a34875a109e7f6b47716a234e898fb/libs/native-federation-core/src/lib/core/build-for-federation.ts#L67C1-L72C4

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That makes absolutely sense. To avoid duplicating the logic, I have moved it to the new config-utils file.

@Aukevanoost

Aukevanoost commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator

Appreciate the fix! One question, one more small request: do you mind also fixing this issue in the v4 version?
https://github.com/native-federation/native-federation-core

@Aukevanoost
Aukevanoost merged commit 8972940 into angular-architects:main Feb 6, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants