Skip to content

[Bug]: persistent cache affects module federation sharing behaviour (shared chunk not extracted) #14827

Description

@SkReD

System Info

System:
OS: macOS 15.6.1
CPU: (14) arm64 Apple M3 Max
Memory: 302.63 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.18.0 - /Users/m.shipov/.nvm/versions/node/v22.18.0/bin/node
Yarn: 1.22.22 - /Users/m.shipov/.nvm/versions/node/v22.18.0/bin/yarn
npm: 10.9.3 - /Users/m.shipov/.nvm/versions/node/v22.18.0/bin/npm
pnpm: 11.2.1 - /Users/m.shipov/.nvm/versions/node/v22.18.0/bin/pnpm
bun: 1.3.4 - /Users/m.shipov/.bun/bin/bun
Browsers:
Chrome: 150.0.7871.125
Safari: 26.2

Details

Persistent cache, created with no shared packages in module federation, affects subsequent builds with sharing enabled if shared module is barrel-file.

Looks like optimized module is cached which leads to absence of this module in next builds. This not happens in webpack.

Reproduce link

https://github.com/SkReD/cache-affects-sharing-behaviour

Reproduce Steps

  1. run pnpm run build. It will clean cache and launch builds in order: no-sharing + cache write and then sharing + cache readonly.
  2. dist for rspack contains no shared chunk and webpack dist directory contains shared chunk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions