Skip to content

fix(enhanced): Do not inject the federation runtime into build time chunk #3225

@lnlfps

Description

@lnlfps

Describe the bug

When working with umijs or father, during the compilation of less modules, some 'build time chunks' are generated. These temporary chunks lack chunkGraph information, leading to errors when generating runtime code.

// enhanced/scr/lib/container/runtime/FederationRuntime.ts 49

const conditionMap = this.compilation.chunkGraph.getChunkConditionMap(
  this.chunk,
  chunkHasJs,
);

Then The current chunk id is build time chunk, the variable this.compilation.chunkGraph is undefined,causing an exception to be thrown

Suggestion

If the chunk's id is build time chunk, do not inject the federation runtime to this chunk. like this:

image

Reproduction

Used Package Manager

npm

System Info

-

Validations

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