Skip to content

feat: provide an option to load the remoteEntry.json via a deploy url#1062

Merged
Aukevanoost merged 2 commits intoangular-architects:mainfrom
WvKuipersVisma:deploy-url-support
Mar 2, 2026
Merged

feat: provide an option to load the remoteEntry.json via a deploy url#1062
Aukevanoost merged 2 commits intoangular-architects:mainfrom
WvKuipersVisma:deploy-url-support

Conversation

@WvKuipersVisma
Copy link

@WvKuipersVisma WvKuipersVisma commented Feb 11, 2026

This changes allows to provide a deployUrl option when calling initFederation to load the remoteEntry.json file from a custom path or domain like so:

initFederation('/assets/federation.manifest.json', {deployUrl: './custom-root/'})
  .catch(err => console.error(err))
  .then(_ => import('./bootstrap'))
  .catch(err => console.error(err));

or:

initFederation('/assets/federation.manifest.json', {deployUrl: 'http://example.com'})
  .catch(err => console.error(err))
  .then(_ => import('./bootstrap'))
  .catch(err => console.error(err));

This is needed when you run the application on a path other then root or when you want to load the assets over a custom domain. (like an CDN)

Closes #866

@WvKuipersVisma
Copy link
Author

@Aukevanoost / @manfredsteyer I Would love to get some feedback (& traction) on this feature as it is a requirement for us to start using native federation.

@Aukevanoost
Copy link
Collaborator

Hi @WvKuipersVisma I'll have a look this weekend, thanks for the PR!

@Aukevanoost
Copy link
Collaborator

Looks good to me, only one small issue:

initFederation('/assets/federation.manifest.json', {deployUrl: './custom-root/'})
  .catch(err => console.error(err))
  .then(_ => import('./bootstrap'))
  .catch(err => console.error(err));

This doesn't work since you're concatinating the folder URL with a / as well. If you take a look at it I'll merge it!

: remotesOrManifestUrl;

const hostInfo = await loadFederationInfo(`./remoteEntry.json${cacheTag}`);
const deployUrl = options?.deployUrl ? `${options.deployUrl}/` : './';
Copy link
Collaborator

Choose a reason for hiding this comment

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

As mentioned, can you add an endsWith / check?

@WvKuipersVisma
Copy link
Author

@Aukevanoost I implemented the requested change. Should be good to merge

@Aukevanoost Aukevanoost merged commit ab639ed into angular-architects:main Mar 2, 2026
@Aukevanoost
Copy link
Collaborator

Fix should be in v21.2.0. I have a small favor. Do you mind also creating this PR on our new v4 repository?
https://github.com/native-federation/native-federation-core/tree/main/packages/runtime

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.

Support deployUrl to load remoteEntry.json

2 participants