module-federation / core

Module Federation is a concept that allows developers to share code and resources across multiple JavaScript applications
https://module-federation.io/
MIT License
1.55k stars 242 forks source link

Optimizing the problem of overly long identifiers of the container entry module of the issuerPath in the stats.json file #2598

Open easy1090 opened 5 months ago

easy1090 commented 5 months ago

Describe the bug

When rsdoctor analyzed a certain business MF project, the build analysis was very slow. It was found that the stats.json containing chunks and modules was nearly 4G, and that each module's issuer path contained the container entry module, and the identifier of the container entry module was 22KB, that string contains 100+ arrays and there were a total of 13,000 modules, resulting in a very large stats.json, which caused rsdoctor to analyze very slowly using stats.json.

But, this issue found from a certain business MF project on rspack, but MF core and rspack mf has same logic on generating the identifier of the container entry module.. So I think if iIcan post a issue on MF directly. Thanks ~

We are looking forward to optimizing the issue of overly long identifiers of the container entry module of the issuerPath in the Stats.json file.

Used Package Manager

pnpm

System Info

System:
    OS: macOS 13.2.1
    CPU: (12) x64 Apple M2 Max
    Memory: 1.40 GB / 64.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v18.19.0/bin/npm
    pnpm: 8.14.3 - ~/.nvm/versions/node/v18.19.0/bin/pnpm
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 16.3

Validations

ScriptedAlchemy commented 5 months ago

Since this is on the rust end, it would be best to reference this in a issue to rspack core directly

easy1090 commented 5 months ago

Since this is on the rust end, it would be best to reference this in a issue to rspack core directly

yes, The above project is of rspack, I'll also post a issue on rspack repo. But I found that mf core has the same container module identifier generation logic:https://github.com/module-federation/core/blob/main/packages/enhanced/src/lib/container/ContainerEntryModule.ts#L98

It would be great if it could be optimized.

github-actions[bot] commented 3 months ago

Stale issue message

ScriptedAlchemy commented 1 month ago

im reluctant to alter the identifier as other things in the ecosystem or other plugins outside my ecosystem rely on the stats identifiers to unpack the configurations specified for federation. Do you have a snippet of the json that shows the long ids?