Skip to content

Two federation build contexts after core #145 #138

Description

@Aukevanoost

native-federation/native-federation-core#145 builds shared mappings apart from exposed modules,
so setup()/build() now run once per mapping bundle plus once for mapping-or-exposed, each
with its own Angular context. Nothing breaks until the ~4.6.0 core range is bumped.

  1. updateFederationTsConfig replaces files wholesale
    (src/tools/esbuild/update-federation-tsconfig.ts:57). Each context's setup() overwrites
    files with only its own entry points, so the mapping entries drop out of the program. In
    watch mode, a mapping that only files pulls in rebuilds without error but keeps serving its
    old content.

    Fix: write the union of all Angular contexts' entry points into files.

  2. Only mapping-or-exposed is disposed (src/builders/build/builder.ts:532), so the mapping
    contexts never reset Angular's shared TS state before the app build (buildForFederation corrupts globalSharedCompilationState, causing "polyfills.ts missing from TypeScript compilation" on Linux #47). The no-arg
    dispose() also stops esbuild, which the app build still needs.

    Fix: dispose every isMappingOrExposed context, leaving esbuild running.

A shared SourceFileCache across the contexts needs no change: Angular shares one the same way
between its browser, polyfills and server bundles.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions