Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Starting build from file cache breaks MFP runtime #9150

Open
AndreyGladkov opened this issue Feb 3, 2025 · 0 comments
Open

[Bug]: Starting build from file cache breaks MFP runtime #9150

AndreyGladkov opened this issue Feb 3, 2025 · 0 comments
Labels
pending triage The issue/PR is currently untouched.

Comments

@AndreyGladkov
Copy link

AndreyGladkov commented Feb 3, 2025

System Info

System:
OS: macOS 15.1
CPU: (8) arm64 Apple M1
Memory: 123.52 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.11.0 - /usr/local/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.3.0 - /opt/homebrew/bin/npm
Browsers:
Chrome: 132.0.6834.160
Safari: 18.1
npmPackages:
@rspack/cli: 1.2.2 => 1.2.2
@rspack/core: 1.2.2 => 1.2.2
@rspack/plugin-react-refresh: ^1.0.1 => 1.0.1

Details

If i enable cache:

experiments: {
        cache: {
            type: "persistent",
            buildDependencies: [
                __filename,
                path.join(__dirname, "./package.json"),
            ],
        },
    }

first run is ok(without cache):
Image
if second run from cache:
Image

index.cjs.js:1494 Uncaught Error: Invalid loadShareSync function call from runtime #RUNTIME-006
args: {"hostName":"app","sharedPkgName":"react"}
https://module-federation.io/guide/troubleshooting/runtime/RUNTIME-006
    at D.loadShareSync (index.cjs.js:1494:19)
    at F.loadShareSync (index.cjs.js:1938:35)
    at f (index.cjs.js:236:35)
    at n.m.<computed> (index.cjs.js:252:29)
    at __webpack_require__ (main.js:6:1508)
    at 787 (react-dom-client.production.js:16:11)
    at __webpack_require__ (main.js:6:1508)
    at 745 (client.js:35:20)
    at __webpack_require__ (main.js:6:1508)
    at 914 (main.js:5:185971)

This happens when I load bootstrap synchronously. But in this example, dependencies are loaded before the runtime and main chunks. And this works correctly when running without cache or with cache and rspack.container.ModuleFederationPluginV1 version.

Reproduce link

https://github.com/AndreyGladkov/rspack-mfp-bug

Reproduce Steps

  1. run yarn && yarn dev
  2. run server yarn start
  3. cancel yarn dev
  4. re-run yarn dev running from cache
  5. see error in console
@AndreyGladkov AndreyGladkov added the pending triage The issue/PR is currently untouched. label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

1 participant