Skip to content

Support async initial entry / module federation #3487

Description

@amccloud

Hey @vio,

It would be nice to set initial: true for chunks directly exposed with module federation. WebpackModuleFederation injects a remote entry chunk that is all auto-generated and only loosely related to app code/the exposed module's size. Subsequently, the remote entry chunk is the only chunk stats list as initial and entry.

While tracking the initial size of the auto-generated code is useful, I'd ideally like to know the size of chunks loaded right after the auto-generated remote entry.

  1. One approach would be to support exposes and sharedModules in stats.json.
  2. Or a general approach capturing and filtering reports by module depth.

I'm a fan of the second approach, where we'd track depth in a build-agnostic way. Depth is also an interesting facet for synchronous and async modules outside of module federation.

To help narrow in on exacts, I created an example test case highlighting a common async app scenario that I'd expect to report initial bundle stats for. The example test and approach 2) don't touch on shared modules, another aspect of module federation currently triggering duplicate dependency reports, requiring stats: { excludeModules: Object.keys(shared) } to suppress.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions