Skip to content

Conversation

@Aukevanoost
Copy link
Collaborator

@Aukevanoost Aukevanoost commented Dec 6, 2025

Finalizing the exhaustive entrypoint resolving.

By default this PR doesn't change the behavior of native-federation. But it does provide a ton of options to improve the flexibility in bundling externals:

includeSecondaries improvement:

There are 3 extra options added to the includeSecondaries property of sharing:

Glob support for skips

Allows for skipping complete sections of secondary entrypoints when creating external bundles.

      ...share({
        "@primeng/themes/aura": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: { skip:["@primeuix/themes/aura/*"]}
        }
      })

Resolving glob exports

Some packages have glob exports in their package.json files, by default these aren't resolved to keep the amount of exported externals to a minimum, but this can now be enabled.

      ...share({
        "@primeng/themes/aura": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: { resolveGlob: true}
        }
      })

Opting out of 'ignoreUnusedDeps'

It is now possible to opt-out of ignoreUnusedDeps per package, handy for when all secondary entrypoints of a certain package should be shared to avoid cross-remote imports.

      ...share({
        "@primeng/themes/aura": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: {keepAll: true}
        }
     })

New bundling type

Before this PR, there were only 2 ways to export externals. "separate" and "default". Where default meant bundling all entrypoints into 1 esbuild action for optimal performance and "separate" to bundle every entrypoint in a single bundle file. Now it's also possible to set a "package" build to bundle per package:

      ...share({
        "@angular/core": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: {keepAll: true},
          build: 'package'
        }
     })

This can help to avoid dangling imports but will also bundle the externals of the package in that same package.

shareAll overrides

It is now possible to override certain externals in the shareAll function, this prevents certain secondary entrypoints from accidentally being added to the final remoteEntry.

    ...shareAll({
      singleton: true,
      strictVersion: true,
      requiredVersion: "auto",
    },
    {
      overrides: {
        "@primeng/themes/aura": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: { skip: "@primeuix/themes/aura/*"},
          build: 'package'
        },
        "primeng": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: { skip: "primeng/icons/*"},
          build: 'package'
        },
        "rxjs": {
          singleton: true,
          strictVersion: true,
          requiredVersion: "auto",
          includeSecondaries: { resolveGlob: true}
        },
      }
    }),
  },

@Aukevanoost Aukevanoost force-pushed the fix/secondary-entry-points-II branch from e6f1056 to 2869ff2 Compare December 17, 2025 17:31
@Aukevanoost Aukevanoost force-pushed the fix/secondary-entry-points-II branch from 1f21d3b to 22984fc Compare December 17, 2025 17:39
@Aukevanoost Aukevanoost merged commit 7317419 into angular-architects:main Dec 18, 2025
1 check passed
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