Describe the bug
ModuleFederation.registerShared() registers a shared provider in shareScopeMap, but does not update instance.options.shared.
This leaves the runtime in an inconsistent state: the provider exists in shareScopeMap, but the shared configuration is missing from instance.options.shared.
When loadShare() is called after dynamic registration, it cannot reliably resolve the newly registered shared module and may throw:
targetShared.get is not a function
The issue can be reproduced with @module-federation/runtime-core@2.8.1 using the reproduction repository below.
I intend to submit a fix for this issue in PR #4950.
Reproduction
https://github.com/dmchoi77/runtime-core-register-shared-repro
Used Package Manager
pnpm
System Info
OS: macOS
Node.js: v22.22.0
pnpm: 10.28.0
Package: @module-federation/runtime-core@2.8.1
Validations
Describe the bug
ModuleFederation.registerShared()registers a shared provider inshareScopeMap, but does not updateinstance.options.shared.This leaves the runtime in an inconsistent state: the provider exists in
shareScopeMap, but the shared configuration is missing frominstance.options.shared.When
loadShare()is called after dynamic registration, it cannot reliably resolve the newly registered shared module and may throw:The issue can be reproduced with
@module-federation/runtime-core@2.8.1using the reproduction repository below.I intend to submit a fix for this issue in PR #4950.
Reproduction
https://github.com/dmchoi77/runtime-core-register-shared-repro
Used Package Manager
pnpm
System Info
Validations